Skip to content

Commit

Permalink
add human readable error in case of httplib client-side error
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Jun 28, 2024
1 parent 2abf301 commit a176c1a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
url = https://github.com/openmultiplayer/cmake-conan.git
[submodule "lib/cpp-httplib"]
path = lib/cpp-httplib
url = https://github.com/ksenonadv/cpp-httplib.git
url = https://github.com/openmultiplayer/cpp-httplib.git
11 changes: 2 additions & 9 deletions Server/Components/LegacyNetwork/legacy_network_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,8 @@ struct AnnounceHTTPResponseHandler final : HTTPResponseHandler
if (status != 200)
{
core->printLn("Couldn't announce legacy network to open.mp list.");
if (status < 100)
{
core->printLn("\t[HTTP Client Error] Status: %d", status);
}
else
{
core->printLn("\t[Server Error] Status: %d", status);
core->printLn("\t[Server Error] Message: %.*s", PRINT_VIEW(body));
}
core->printLn("\t[Server Error] Status: %d", status);
core->printLn("\t[Server Error] Message: %.*s", PRINT_VIEW(body));
core->printLn("This won't affect the server's behaviour.");
}
delete this;
Expand Down
4 changes: 4 additions & 0 deletions Server/Source/core_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,10 @@ class HTTPAsyncIO
else
{
params->response = int(res.error());
if (params->response < 100)
{
params->body = httplib::detail::internal_error_to_string(res.error());
}
}

params->finished.store(true);
Expand Down
2 changes: 1 addition & 1 deletion lib/cpp-httplib
Submodule cpp-httplib updated 1 files
+23 −0 httplib.h

0 comments on commit a176c1a

Please sign in to comment.