Skip to content

Commit

Permalink
http/exception: add formatter for httpd::base_exception
Browse files Browse the repository at this point in the history
to ease the debugging of http related failures.

Signed-off-by: Kefu Chai <[email protected]>

Closes scylladb#1843
  • Loading branch information
tchaikov authored and xemul committed Sep 25, 2023
1 parent ae94791 commit f2f3234
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/seastar/http/exception.hh
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,12 @@ SEASTAR_MODULE_EXPORT_END
}

}

SEASTAR_MODULE_EXPORT
template <>
struct fmt::formatter<seastar::httpd::base_exception> {
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
auto format(const seastar::httpd::base_exception& e, fmt::format_context& ctx) const {
return fmt::format_to(ctx.out(), "{} ({})", e.what(), e.status());
}
};

0 comments on commit f2f3234

Please sign in to comment.