diff --git a/src/http/middleware.zig b/src/http/middleware.zig index bb5c379..825f3c7 100644 --- a/src/http/middleware.zig +++ b/src/http/middleware.zig @@ -201,7 +201,7 @@ pub fn CatchErrors(comptime ErrorHandler: type) type { return self.error_handler.handle( req, res, - addField(ctx, "err", err), + addField(addField(ctx, "err", err), "err_trace", @errorReturnTrace()), next, ); }; @@ -218,7 +218,10 @@ pub fn catchErrors(error_handler: anytype) CatchErrors(@TypeOf(error_handler)) { pub const default_error_handler = struct { fn handle(_: @This(), req: anytype, res: anytype, ctx: anytype, _: anytype) !void { const should_log = !@import("builtin").is_test; - if (should_log) std.log.err("Error {} on uri {s}", .{ ctx.err, req.uri }); + if (should_log) { + std.log.err("Error {} on uri {s}", .{ ctx.err, req.uri }); + std.log.debug("Additional details: {?}", .{ctx.err_trace}); + } // Tell the server to close the connection after this request res.should_close = true;