{koji,worker}/server: log errors returned from handlers
Previously, we had no clue what errors were catched by the default echo's error handler. Thus, in the case of an error, we were basically blind. Let's log all errors so we can investigate them later. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
cbc9082fac
commit
e10a7f1ccc
2 changed files with 12 additions and 0 deletions
|
|
@ -46,6 +46,12 @@ func (s *Server) Handler(path string) http.Handler {
|
|||
e.Binder = binder{}
|
||||
e.StdLogger = s.logger
|
||||
|
||||
// log errors returned from handlers
|
||||
e.HTTPErrorHandler = func(err error, c echo.Context) {
|
||||
log.Println(c.Path(), c.QueryParams().Encode(), err.Error())
|
||||
e.DefaultHTTPErrorHandler(err, c)
|
||||
}
|
||||
|
||||
api.RegisterHandlers(e.Group(path), &apiHandlers{s})
|
||||
|
||||
return e
|
||||
|
|
|
|||
|
|
@ -62,6 +62,12 @@ func (s *Server) Handler() http.Handler {
|
|||
e.Binder = binder{}
|
||||
e.StdLogger = s.logger
|
||||
|
||||
// log errors returned from handlers
|
||||
e.HTTPErrorHandler = func(err error, c echo.Context) {
|
||||
log.Println(c.Path(), c.QueryParams().Encode(), err.Error())
|
||||
e.DefaultHTTPErrorHandler(err, c)
|
||||
}
|
||||
|
||||
handler := apiHandlers{
|
||||
server: s,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue