mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Add APIErrorWrapper so that underlying errors can be logged (#1246)
This commit is contained in:
@@ -27,6 +27,9 @@ func handleErrorResponse(c *gin.Context, err error) {
|
||||
// HandleErrorResponse used to handle response errors in the same way.
|
||||
func HandleErrorResponse(ctx context.Context, w http.ResponseWriter, err error) {
|
||||
log := common.Logger(ctx)
|
||||
if w, ok := err.(models.APIErrorWrapper); ok {
|
||||
log = log.WithField("root_error", w.RootError())
|
||||
}
|
||||
|
||||
if ctx.Err() == context.Canceled {
|
||||
log.Info("client context cancelled")
|
||||
|
||||
Reference in New Issue
Block a user