aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/httpasio.cpp
diff options
context:
space:
mode:
authorzousar <[email protected]>2021-12-02 08:13:42 -0700
committerGitHub <[email protected]>2021-12-02 08:13:42 -0700
commit7e89dde9d3f0459b5aa3f2236ceb58fc8c8499f8 (patch)
tree512d775366031dc7a5b3e551b112d96cf2c5f1ca /zenhttp/httpasio.cpp
parentUse 'Platform' instead of 'OSFamily' for Horde condition (diff)
parentWrap asio call to Service->HandleRequest in try/catch like http.sys. (diff)
downloadzen-7e89dde9d3f0459b5aa3f2236ceb58fc8c8499f8.tar.xz
zen-7e89dde9d3f0459b5aa3f2236ceb58fc8c8499f8.zip
Merge pull request #32 from EpicGames/non-elevated-asio
Wrap asio call to Service->HandleRequest in try/catch like http.sys.
Diffstat (limited to 'zenhttp/httpasio.cpp')
-rw-r--r--zenhttp/httpasio.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/zenhttp/httpasio.cpp b/zenhttp/httpasio.cpp
index 9a23a25ef..7ee7193d1 100644
--- a/zenhttp/httpasio.cpp
+++ b/zenhttp/httpasio.cpp
@@ -500,7 +500,17 @@ HttpServerConnection::HandleRequest()
if (!HandlePackageOffers(*Service, Request, m_PackageHandler))
{
- Service->HandleRequest(Request);
+ try
+ {
+ Service->HandleRequest(Request);
+ }
+ catch (std::exception& ex)
+ {
+ ZEN_ERROR("Caught exception while handling request: '{}'", ex.what());
+
+ Request.WriteResponse(HttpResponseCode::InternalServerError, HttpContentType::kText, ex.what());
+ }
+
}
if (std::unique_ptr<HttpResponse> Response = std::move(Request.m_Response))