mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-25 12:00:29 +00:00
validate using currency service
This commit is contained in:
parent
e647419eed
commit
fa676d6351
2 changed files with 14 additions and 1 deletions
|
@ -88,7 +88,7 @@ func (fe FieldErrors) Nil() bool {
|
|||
return len(fe) == 0
|
||||
}
|
||||
|
||||
// Error implments the error interface.
|
||||
// Error implements the error interface.
|
||||
func (fe FieldErrors) Error() string {
|
||||
d, err := json.Marshal(fe)
|
||||
if err != nil {
|
||||
|
@ -101,6 +101,10 @@ func NewFieldErrors(errs ...FieldError) FieldErrors {
|
|||
return errs
|
||||
}
|
||||
|
||||
func NewFieldError(field, reason string) FieldError {
|
||||
return FieldError{Field: field, Error: reason}
|
||||
}
|
||||
|
||||
func IsFieldError(err error) bool {
|
||||
v := FieldErrors{}
|
||||
return errors.As(err, &v)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue