Spaces:
Runtime error
Runtime error
| 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 | |
| } | |