DanzApp-BE-Test / models /error /validation_error.go
lifedebugger's picture
Deploy files from GitHub repository
0ce191c
raw
history blame contribute delete
513 Bytes
package http_error
// ValidationError is a custom error type for input validation failures
type ValidationError struct {
msg string
}
// NewValidationError creates a new validation error
func NewValidationError(msg string) error {
return &ValidationError{msg: msg}
}
func (e *ValidationError) Error() string {
return e.msg
}
// Is implements the errors.Is interface to check error type
func (e *ValidationError) Is(target error) bool {
_, ok := target.(*ValidationError)
return ok
}