mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Update httplib.h
use std::exception_ptr
This commit is contained in:
parent
5e6f973b99
commit
72d3f4896a
1 changed files with 3 additions and 2 deletions
|
@ -616,7 +616,7 @@ public:
|
||||||
using Handler = std::function<void(const Request &, Response &)>;
|
using Handler = std::function<void(const Request &, Response &)>;
|
||||||
|
|
||||||
using ExceptionHandler =
|
using ExceptionHandler =
|
||||||
std::function<void(const Request &, Response &, std::exception &e)>;
|
std::function<void(const Request &, Response &, std::exception_ptr &ep)>;
|
||||||
|
|
||||||
enum class HandlerResponse {
|
enum class HandlerResponse {
|
||||||
Handled,
|
Handled,
|
||||||
|
@ -5733,7 +5733,8 @@ Server::process_request(Stream &strm, bool close_connection,
|
||||||
routed = routing(req, res, strm);
|
routed = routing(req, res, strm);
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
if (exception_handler_) {
|
if (exception_handler_) {
|
||||||
exception_handler_(req, res, e);
|
auto ep = std::current_exception();
|
||||||
|
exception_handler_(req, res, ep);
|
||||||
routed = true;
|
routed = true;
|
||||||
} else {
|
} else {
|
||||||
res.status = 500;
|
res.status = 500;
|
||||||
|
|
Loading…
Reference in a new issue