File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -344,24 +344,28 @@ func (e *Echo) DefaultHTTPErrorHandler(err error, c Context) {
344
344
he , ok := err .(* HTTPError )
345
345
if ok {
346
346
if he .Internal != nil {
347
- err = fmt .Errorf ("%v, %v" , err , he .Internal )
347
+ if herr , ok := he .Internal .(* HTTPError ); ok {
348
+ he = herr
349
+ }
348
350
}
349
351
} else {
350
352
he = & HTTPError {
351
- Code : http .StatusInternalServerError ,
353
+ Code : http .StatusInternalServerError ,
352
354
Message : http .StatusText (http .StatusInternalServerError ),
353
355
}
354
356
}
355
357
if e .Debug {
356
358
he .Message = err .Error ()
359
+ } else if m , ok := he .Message .(string ); ok {
360
+ he .Message = Map {"message" : m }
357
361
}
358
362
359
363
// Send response
360
364
if ! c .Response ().Committed {
361
365
if c .Request ().Method == http .MethodHead { // Issue #608
362
366
err = c .NoContent (he .Code )
363
367
} else {
364
- err = c .JSON (he .Code , he )
368
+ err = c .JSON (he .Code , he . Message )
365
369
}
366
370
if err != nil {
367
371
e .Logger .Error (err )
You can’t perform that action at this time.
0 commit comments