File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,13 @@ func (c *Context) NoContent(code int) error {
80
80
}
81
81
82
82
// Error invokes the registered HTTP error handler.
83
- func (c * Context ) Error (err error , code int ) {
83
+ func (c * Context ) Error (err error ) {
84
+ c .echo .httpErrorHandler (err , http .StatusInternalServerError , c )
85
+ }
86
+
87
+ // Error invokes the registered HTTP error handler.
88
+ // with a custom code
89
+ func (c * Context ) ErrorWithCode (err error , code int ) {
84
90
c .echo .httpErrorHandler (err , code , c )
85
91
}
86
92
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package middleware
2
2
3
3
import (
4
4
"log"
5
- "net/http"
6
5
"time"
7
6
8
7
"github.com/labstack/echo"
@@ -13,7 +12,7 @@ func Logger(h echo.HandlerFunc) echo.HandlerFunc {
13
12
return func (c * echo.Context ) error {
14
13
start := time .Now ()
15
14
if err := h (c ); err != nil {
16
- c .Error (err , http . StatusInternalServerError )
15
+ c .Error (err )
17
16
}
18
17
end := time .Now ()
19
18
m := c .Request .Method
You can’t perform that action at this time.
0 commit comments