u
This commit is contained in:
1 parent
69d03709ba
commit
44fb48ef6a
9 files changed
+625
-25
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package errs
|
||||
|
||||
import "fmt"
|
||||
|
||||
type ValidationError struct {
|
||||
field string
|
||||
message string
|
||||
}
|
||||
|
||||
func (e *ValidationError) Error() string {
|
||||
return fmt.Sprintf("字段 %s: %s", e.field, e.message)
|
||||
}
|
||||
|
||||
func NewValidationError(field, message string) error {
|
||||
return &ValidationError{
|
||||
field: field,
|
||||
message: message,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user