1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-21 07:34:08 +00:00

add doc comment to Request.sendError

This commit is contained in:
Rene Schallner 2024-04-21 20:07:16 +02:00
parent d17436932d
commit 5f368cf125

View file

@ -317,8 +317,12 @@ pub fn getUserContext(self: *const Self, comptime Context: type) ?*Context {
return null;
}
}
/// Tries to send an error stack trace.
/// Use like this:
/// ```zig
/// const err = zap.HttpError; // this is to show that `err` is an Error
/// r.sendError(err, if (@errorReturnTrace()) |t| t.* else null, 505);
/// ```
pub fn sendError(self: *const Self, err: anyerror, err_trace: ?std.builtin.StackTrace, errorcode_num: usize) void {
// TODO: query accept headers
if (self._internal_sendError(err, err_trace, errorcode_num)) {