diff options
| author | Dan Engelbrecht <[email protected]> | 2025-09-15 10:58:25 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-09-15 10:58:25 +0200 |
| commit | b8c0b72232642183156e59ff8d2535cc3353ff0e (patch) | |
| tree | 4da3fd349300839e1863ded840b0ce97cbc61589 /src/zenhttp/servers/httpplugin.cpp | |
| parent | 5.7.1 (diff) | |
| download | zen-b8c0b72232642183156e59ff8d2535cc3353ff0e.tar.xz zen-b8c0b72232642183156e59ff8d2535cc3353ff0e.zip | |
revise exception vs error (#495)
- Change BadAlloc exceptions in GC to warnings
- Add explict ASSERT exception catch in http plugin request processing
- Make exceptions handled in http request processing to warnings
Diffstat (limited to 'src/zenhttp/servers/httpplugin.cpp')
| -rw-r--r-- | src/zenhttp/servers/httpplugin.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/zenhttp/servers/httpplugin.cpp b/src/zenhttp/servers/httpplugin.cpp index 155f3fa02..d6ca7e1c5 100644 --- a/src/zenhttp/servers/httpplugin.cpp +++ b/src/zenhttp/servers/httpplugin.cpp @@ -396,6 +396,14 @@ HttpPluginConnectionHandler::HandleRequest() { Service->HandleRequest(Request); } + catch (const AssertException& AssertEx) + { + // Drop any partially formatted response + Request.m_Response.reset(); + + ZEN_ERROR("Caught assert exception while handling request: {}", AssertEx.FullDescription()); + Request.WriteResponse(HttpResponseCode::InternalServerError, HttpContentType::kText, AssertEx.FullDescription()); + } catch (const std::system_error& SystemError) { // Drop any partially formatted response @@ -407,9 +415,9 @@ HttpPluginConnectionHandler::HandleRequest() } else { - ZEN_ERROR("Caught system error exception while handling request: {}. ({})", - SystemError.what(), - SystemError.code().value()); + ZEN_WARN("Caught system error exception while handling request: {}. ({})", + SystemError.what(), + SystemError.code().value()); Request.WriteResponse(HttpResponseCode::InternalServerError, HttpContentType::kText, SystemError.what()); } } @@ -425,7 +433,7 @@ HttpPluginConnectionHandler::HandleRequest() // Drop any partially formatted response Request.m_Response.reset(); - ZEN_ERROR("Caught exception while handling request: {}", ex.what()); + ZEN_WARN("Caught exception while handling request: {}", ex.what()); Request.WriteResponse(HttpResponseCode::InternalServerError, HttpContentType::kText, ex.what()); } } |