27 lines
486 B
Go
27 lines
486 B
Go
package form
|
|
|
|
type ValidationError interface {
|
|
error
|
|
Message() string
|
|
}
|
|
|
|
type validationError struct {
|
|
message string
|
|
}
|
|
|
|
// Error implements ValidationError.
|
|
func (v *validationError) Error() string {
|
|
return "validation error"
|
|
}
|
|
|
|
// Message implements ValidationError.
|
|
func (v *validationError) Message() string {
|
|
return v.message
|
|
}
|
|
|
|
var _ ValidationError = &validationError{}
|
|
|
|
func NewValidationError(message string) ValidationError {
|
|
return &validationError{message: message}
|
|
}
|