mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 15:14:08 +00:00
zap.Endpont.Listener and zap.App now support on_error callbacks:
zap.Endpont.Listener.Settings contains an `on_error` optional callback
field.
zap.App supports those two callbacks:
/// ```zig
/// const MyContext = struct {
/// // You may (optionally) define the following global handlers:
/// pub fn unhandledRequest(_: *MyContext, _: Allocator, _: Request) anyerror!void {}
/// pub fn unhandledError(_: *MyContext, _: Request, _: anyerror) void {}
/// };
/// ```
The `endpoint` example has been updated to showcase `on_error`, and the
new example `app_errors` showcases `Context.unhandledError`.
|
||
|---|---|---|
| .. | ||
| auth.zig | ||
| basic.zig | ||
| errors.zig | ||