Skip to content

Commit

Permalink
fix error code
Browse files Browse the repository at this point in the history
  • Loading branch information
katherinelc321 committed May 16, 2024
1 parent 19d7253 commit c84f72d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/middleware_validatestatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func MiddlewareValidateStatic(w http.ResponseWriter, r *http.Request, next http.

if resourceGroupName != "" {
if !rxResourceGroupName.MatchString(resourceGroupName) {
arm.WriteError(w, http.StatusBadRequest, arm.CloudErrorCodeResourceGroupNotFound, "", "Resource group '%s' is invalid.", resourceGroupName)
arm.WriteError(w, http.StatusBadRequest, arm.CloudErrorInvalidResourceGroupName, "", "Resource group '%s' is invalid.", resourceGroupName)
return
}
}

if resourceName != "" {
if !rxResourceName.MatchString(resourceName) {
arm.WriteError(w, http.StatusBadRequest, arm.CloudErrorCodeResourceNotFound, "", "The Resource '%s/%s' under resource group '%s' is invalid.", api.ResourceType, resourceName, resourceGroupName)
arm.WriteError(w, http.StatusBadRequest, arm.CloudErrorInvalidResourceName, "", "The Resource '%s/%s' under resource group '%s' is invalid.", api.ResourceType, resourceName, resourceGroupName)
return
}
}
Expand Down
2 changes: 2 additions & 0 deletions internal/api/arm/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const (
CloudErrorCodeResourceNotFound = "ResourceNotFound"
CloudErrorCodeResourceGroupNotFound = "ResourceGroupNotFound"
CloudErrorCodeInvalidSubscriptionID = "InvalidSubscriptionID"
CloudErrorInvalidResourceName = "InvalidResourceName"
CloudErrorInvalidResourceGroupName = "InvalidResourceGroupName"
)

// CloudError represents a complete resource provider error.
Expand Down

0 comments on commit c84f72d

Please sign in to comment.