NewResourceNotFoundError creates a user-friendly error for resource not found scenarios Leverages existing util.NewApiError() function
(resourceType, resourceId string)
| 32 | // NewResourceNotFoundError creates a user-friendly error for resource not found scenarios |
| 33 | // Leverages existing util.NewApiError() function |
| 34 | func NewResourceNotFoundError(resourceType, resourceId string) *ApiError { |
| 35 | return NewApiError( |
| 36 | http.StatusNotFound, |
| 37 | fmt.Sprintf("%s with ID '%s' not found", resourceType, resourceId), |
| 38 | fmt.Sprintf("%s not found: %s", resourceType, resourceId), |
| 39 | ).WithCode(constants.ResourceNotFound). |
| 40 | WithUserDetailMessage(fmt.Sprintf("The requested %s does not exist or has been deleted.", resourceType)) |
| 41 | } |
| 42 | |
| 43 | // NewDuplicateResourceError creates a user-friendly error for duplicate resource scenarios |
| 44 | func NewDuplicateResourceError(resourceType, resourceName string) *ApiError { |
no test coverage detected
searching dependent graphs…