mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Merge branch 'try-catch-handle' of https://github.com/acron0/crow into acron0-try-catch-handle
Conflicts: amalgamate/crow_all.h
This commit is contained in:
commit
f6fdf68fe2
@ -6966,7 +6966,25 @@ public:
|
||||
|
||||
CROW_LOG_DEBUG << "Matched rule '" << ((TaggedRule<>*)rules_[rule_index].get())->rule_ << "' " << (uint32_t)req.method << " / " << rules_[rule_index]->methods();
|
||||
|
||||
rules_[rule_index]->handle(req, res, found.second);
|
||||
// any uncaught exceptions become 500s
|
||||
try
|
||||
{
|
||||
rules_[rule_index]->handle(req, res, found.second);
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
CROW_LOG_ERROR << "An uncaught exception occurred: " << e.what();
|
||||
res = response(500);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
CROW_LOG_ERROR << "An uncaught exception occurred. The type was unknown so no information was available.";
|
||||
res = response(500);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void debug_print()
|
||||
|
@ -655,7 +655,25 @@ public:
|
||||
|
||||
CROW_LOG_DEBUG << "Matched rule '" << ((TaggedRule<>*)rules_[rule_index].get())->rule_ << "' " << (uint32_t)req.method << " / " << rules_[rule_index]->methods();
|
||||
|
||||
rules_[rule_index]->handle(req, res, found.second);
|
||||
// any uncaught exceptions become 500s
|
||||
try
|
||||
{
|
||||
rules_[rule_index]->handle(req, res, found.second);
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
CROW_LOG_ERROR << "An uncaught exception occurred: " << e.what();
|
||||
res = response(500);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
CROW_LOG_ERROR << "An uncaught exception occurred. The type was unknown so no information was available.";
|
||||
res = response(500);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void debug_print()
|
||||
|
Loading…
Reference in New Issue
Block a user