MCPcopy
hub / github.com/devtron-labs/devtron / NewValidationErrorForField

Function NewValidationErrorForField

internal/util/ResourceErrorFactory.go:54–61  ·  view source on GitHub ↗

NewValidationErrorForField creates a user-friendly error for field validation failures

(fieldName, reason string)

Source from the content-addressed store, hash-verified

52
53// NewValidationErrorForField creates a user-friendly error for field validation failures
54func 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
64func NewInvalidPathParameterError(paramName, paramValue string) *ApiError {

Callers 5

getIntPathParamMethod · 0.92
HandleValidationErrorFunction · 0.92
convertToIntWithContextFunction · 0.92
WriteValidationErrorFunction · 0.92

Calls 3

NewApiErrorFunction · 0.85
WithUserDetailMessageMethod · 0.80
WithCodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…