Spaces:
Runtime error
Runtime error
File size: 513 Bytes
0ce191c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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
}
|