diff options
Diffstat (limited to 'modules/web/middleware')
-rw-r--r-- | modules/web/middleware/binding.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/web/middleware/binding.go b/modules/web/middleware/binding.go index 88a3920f6e..636e655b9e 100644 --- a/modules/web/middleware/binding.go +++ b/modules/web/middleware/binding.go @@ -136,7 +136,16 @@ func Validate(errs binding.Errors, data map[string]interface{}, f Form, l transl case validation.ErrRegexPattern: data["ErrorMsg"] = trName + l.Tr("form.regex_pattern_error", errs[0].Message) default: - data["ErrorMsg"] = l.Tr("form.unknown_error") + " " + errs[0].Classification + msg := errs[0].Classification + if msg != "" && errs[0].Message != "" { + msg += ": " + } + + msg += errs[0].Message + if msg == "" { + msg = l.Tr("form.unknown_error") + } + data["ErrorMsg"] = trName + ": " + msg } return errs } |