🔊 Add WithLogger so we can log the rendered error

This commit is contained in:
Dan Jones 2024-01-22 10:29:58 -06:00
commit 2324d738bc
3 changed files with 29 additions and 0 deletions

View file

@ -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)
}
}