mirror of
https://github.com/labstack/echo.git
synced 2025-01-22 03:09:04 +02:00
fixed http error handler
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
8f0d340f34
commit
70b5cfbb26
7
echo.go
7
echo.go
@ -283,7 +283,10 @@ func (e *Echo) DefaultHTTPErrorHandler(err error, c Context) {
|
||||
code = he.Code
|
||||
msg = he.Message
|
||||
} else {
|
||||
msg = Map{"message": err.Error()}
|
||||
msg = err.Error()
|
||||
}
|
||||
if reflect.TypeOf(msg).Kind() != reflect.Ptr {
|
||||
msg = Map{"message": msg}
|
||||
}
|
||||
|
||||
if !c.Response().Committed {
|
||||
@ -578,7 +581,7 @@ func (e *Echo) ShutdownTLS(timeout time.Duration) {
|
||||
|
||||
// NewHTTPError creates a new HTTPError instance.
|
||||
func NewHTTPError(code int, message ...interface{}) *HTTPError {
|
||||
he := &HTTPError{Code: code, Message: Map{"message": http.StatusText(code)}}
|
||||
he := &HTTPError{Code: code, Message: http.StatusText(code)}
|
||||
if len(message) > 0 {
|
||||
he.Message = message[0]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user