NewValidationErrorForField creates a user-friendly error for field validation failures
(fieldName, reason string)
| 52 | |
| 53 | // NewValidationErrorForField creates a user-friendly error for field validation failures |
| 54 | func NewValidationErrorForField(fieldName, reason string) *ApiError { |
| 55 | return NewApiError( |
| 56 | http.StatusBadRequest, |
| 57 | fmt.Sprintf("Validation failed for field '%s': %s", fieldName, reason), |
| 58 | fmt.Sprintf("validation failed for %s: %s", fieldName, reason), |
| 59 | ).WithCode(constants.ValidationFailed). |
| 60 | WithUserDetailMessage("Please check the field value and try again.") |
| 61 | } |
| 62 | |
| 63 | // NewInvalidPathParameterError creates a user-friendly error for invalid path parameters |
| 64 | func NewInvalidPathParameterError(paramName, paramValue string) *ApiError { |
no test coverage detected
searching dependent graphs…