🔊 Add WithLogger so we can log the rendered error
This commit is contained in:
parent
b4b4f041d7
commit
2324d738bc
3 changed files with 29 additions and 0 deletions
|
|
@ -48,6 +48,12 @@ func ErrorMiddleware(opts ...Option) gin.HandlerFunc {
|
|||
re = rErrors.NewInternalError("%w", err)
|
||||
}
|
||||
|
||||
for _, logger := range conf.loggers {
|
||||
logger(c, re)
|
||||
}
|
||||
|
||||
c.Set("rendered_error", re)
|
||||
|
||||
c.JSON(re.Status(), re)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue