Update httplib.h

use std::exception_ptr
This commit is contained in:
Kai Aoki 2022-07-12 00:10:57 +09:00
parent 5e6f973b99
commit 72d3f4896a

View file

@ -616,7 +616,7 @@ public:
using Handler = std::function<void(const Request &, Response &)>;
using ExceptionHandler =
std::function<void(const Request &, Response &, std::exception &e)>;
std::function<void(const Request &, Response &, std::exception_ptr &ep)>;
enum class HandlerResponse {
Handled,
@ -5733,7 +5733,8 @@ Server::process_request(Stream &strm, bool close_connection,
routed = routing(req, res, strm);
} catch (std::exception &e) {
if (exception_handler_) {
exception_handler_(req, res, e);
auto ep = std::current_exception();
exception_handler_(req, res, ep);
routed = true;
} else {
res.status = 500;