1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00
zap/examples/endpoint
renerocksai 8078b96d3f add on_uncaught_error behavior to zap.App, add on_error callbacks
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`.
2025-04-02 09:53:46 +02:00
..
html add http method PATCH for endpoint listener 2023-05-16 14:58:52 -07:00
error.zig add on_uncaught_error behavior to zap.App, add on_error callbacks 2025-04-02 09:53:46 +02:00
main.zig add on_uncaught_error behavior to zap.App, add on_error callbacks 2025-04-02 09:53:46 +02:00
stopendpoint.zig cleanup unused params where applicable (ie non-instructive) 2025-03-30 19:58:22 +02:00
users.zig removed Self and @This() as much as possible 2025-03-21 18:57:33 +01:00
userweb.zig Improved & generalized checkEndpoint functions 2025-03-30 19:37:40 +02:00