From 4f561b17cfbb038c9ab01364db49ed75bad6124a Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 20 Feb 2024 22:00:19 +0100 Subject: adding context to http.sys error message added some context to http.sys API call error reporting --- CHANGELOG.md | 1 + src/zenhttp/servers/httpsys.cpp | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47b88b9fa..897318fd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Improvement: Add more messaging and progress during oplog import/export - Improvement: Large loose file attachments are now saved to temp files after compressing during oplog export to reduce memory pressure - Improvement: Keep track of added ops during GCV2 instead of rescanning full oplog when added ops are detected +- Improvement: Added context to some http.sys warnings caused by HTTP API error returns - Bugfix: Make sure we clear read callback when doing Put in HttpClient to avoid timeout due to not sending data when reusing sessions - Bugfix: Respect `--ignore-missing-attachments` in `oplog-export` command when loose file is missing on disk - Bugfix: Only try to traverse an objectstore bucket if it really exists diff --git a/src/zenhttp/servers/httpsys.cpp b/src/zenhttp/servers/httpsys.cpp index 5cd273c40..4b812a127 100644 --- a/src/zenhttp/servers/httpsys.cpp +++ b/src/zenhttp/servers/httpsys.cpp @@ -524,7 +524,7 @@ HttpMessageResponseRequest::HandleCompletion(ULONG IoResult, ULONG_PTR NumberOfB if (IoResult != NO_ERROR) { - ZEN_WARN("response aborted due to error: '{}'", GetSystemErrorAsString(IoResult)); + ZEN_WARN("response aborted due to error: {}", GetSystemErrorAsString(IoResult)); // if one transmit failed there's really no need to go on return nullptr; @@ -876,7 +876,7 @@ HttpAsyncWorkRequest::AsyncWorkItem::Execute() catch (std::exception& Ex) { return (void)Tx.IssueNextRequest( - new HttpMessageResponseRequest(Tx, 500, fmt::format("Exception thrown in async work: '{}'", Ex.what()))); + new HttpMessageResponseRequest(Tx, 500, fmt::format("Exception thrown in async work: {}", Ex.what()))); } } @@ -1483,11 +1483,11 @@ HttpSysTransaction::IssueNextRequest(HttpSysRequestHandler* NewCompletionHandler return true; } - ZEN_WARN("IssueRequest() failed: '{}'", ErrorCode.message()); + ZEN_WARN("IssueRequest() failed: {}", ErrorCode.message()); } catch (std::exception& Ex) { - ZEN_ERROR("exception caught in IssueNextRequest(): '{}'", Ex.what()); + ZEN_ERROR("exception caught in IssueNextRequest(): {}", Ex.what()); } // something went wrong, no request is pending @@ -1826,7 +1826,17 @@ InitialRequestHandler::IssueRequest(std::error_code& ErrorCode) ErrorCode = MakeErrorCode(HttpApiResult); - ZEN_WARN("HttpReceiveHttpRequest failed, error: '{}'", ErrorCode.message()); + if (IsInitialRequest()) + { + ZEN_WARN("initial HttpReceiveHttpRequest failed, error: {}", ErrorCode.message()); + } + else + { + ZEN_WARN("HttpReceiveHttpRequest (offset: {}, content-length: {}) failed, error: {}", + m_CurrentPayloadOffset, + m_PayloadBuffer.GetSize(), + ErrorCode.message()); + } return; } -- cgit v1.2.3