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 | |
| 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')
| -rw-r--r-- | src/zenhttp/servers/httpasio.cpp | 8 | ||||
| -rw-r--r-- | src/zenhttp/servers/httpplugin.cpp | 16 | ||||
| -rw-r--r-- | src/zenhttp/servers/httpsys.cpp | 4 | ||||
| -rw-r--r-- | src/zenstore/gc.cpp | 32 |
4 files changed, 34 insertions, 26 deletions
diff --git a/src/zenhttp/servers/httpasio.cpp b/src/zenhttp/servers/httpasio.cpp index 5392140d1..2023b6d98 100644 --- a/src/zenhttp/servers/httpasio.cpp +++ b/src/zenhttp/servers/httpasio.cpp @@ -522,9 +522,9 @@ HttpServerConnection::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()); } } @@ -540,7 +540,7 @@ HttpServerConnection::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()); } } 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()); } } diff --git a/src/zenhttp/servers/httpsys.cpp b/src/zenhttp/servers/httpsys.cpp index 9bbfef255..95d83911d 100644 --- a/src/zenhttp/servers/httpsys.cpp +++ b/src/zenhttp/servers/httpsys.cpp @@ -2056,7 +2056,7 @@ InitialRequestHandler::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesT return new HttpMessageResponseRequest(Transaction(), (uint16_t)HttpResponseCode::InsufficientStorage, SystemError.what()); } - 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()); return new HttpMessageResponseRequest(Transaction(), (uint16_t)HttpResponseCode::InternalServerError, SystemError.what()); } catch (const std::bad_alloc& BadAlloc) @@ -2065,7 +2065,7 @@ InitialRequestHandler::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfBytesT } catch (const std::exception& ex) { - ZEN_ERROR("Caught exception while handling request: '{}'", ex.what()); + ZEN_WARN("Caught exception while handling request: '{}'", ex.what()); return new HttpMessageResponseRequest(Transaction(), (uint16_t)HttpResponseCode::InternalServerError, ex.what()); } } diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp index b08e6a3ca..1ddb25364 100644 --- a/src/zenstore/gc.cpp +++ b/src/zenstore/gc.cpp @@ -764,7 +764,7 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed removing expired data for {}. Reason: '{}'", Owner->GetGcName(Ctx), Ex.what()); + ZEN_WARN("GCV2: Failed removing expired data for {}. Reason: '{}'", Owner->GetGcName(Ctx), Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) @@ -857,9 +857,9 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed creating reference pruners for {}. Reason: '{}'", - ReferenceStore->GetGcName(Ctx), - Ex.what()); + ZEN_WARN("GCV2: Failed creating reference pruners for {}. Reason: '{}'", + ReferenceStore->GetGcName(Ctx), + Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) @@ -969,9 +969,9 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed creating reference checkers for {}. Reason: '{}'", - Referencer->GetGcName(Ctx), - Ex.what()); + ZEN_WARN("GCV2: Failed creating reference checkers for {}. Reason: '{}'", + Referencer->GetGcName(Ctx), + Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) @@ -1083,9 +1083,9 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed creating reference validators for {}. Reason: '{}'", - Referencer->GetGcName(Ctx), - Ex.what()); + ZEN_WARN("GCV2: Failed creating reference validators for {}. Reason: '{}'", + Referencer->GetGcName(Ctx), + Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) @@ -1148,7 +1148,7 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed precaching for {}. Reason: '{}'", Checker->GetGcName(Ctx), Ex.what()); + ZEN_WARN("GCV2: Failed precaching for {}. Reason: '{}'", Checker->GetGcName(Ctx), Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) @@ -1368,9 +1368,9 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed removing unused data for {}. Reason: '{}'", - Pruner->GetGcName(Ctx), - Ex.what()); + ZEN_WARN("GCV2: Failed removing unused data for {}. Reason: '{}'", + Pruner->GetGcName(Ctx), + Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) @@ -1451,7 +1451,7 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed compacting store {}. Reason: '{}'", Compactor->GetGcName(Ctx), Ex.what()); + ZEN_WARN("GCV2: Failed compacting store {}. Reason: '{}'", Compactor->GetGcName(Ctx), Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) @@ -1509,7 +1509,7 @@ GcManager::CollectGarbage(const GcSettings& Settings) } catch (const std::bad_alloc& Ex) { - ZEN_ERROR("GCV2: Failed validating referencer {}. Reason: '{}'", ReferenceValidator->GetGcName(Ctx), Ex.what()); + ZEN_WARN("GCV2: Failed validating referencer {}. Reason: '{}'", ReferenceValidator->GetGcName(Ctx), Ex.what()); SetCancelGC(true); } catch (const std::exception& Ex) |