Skip to content

Commit

Permalink
add doc comment to Request.sendError
Browse files Browse the repository at this point in the history
  • Loading branch information
renerocksai committed Apr 21, 2024
1 parent d174369 commit 5f368cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/request.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 5f368cf

Please sign in to comment.