Skip to content

Commit

Permalink
LibWeb/ResourceLoader: Display HTTP reason phrase in error status
Browse files Browse the repository at this point in the history
  • Loading branch information
rmg-x committed Oct 10, 2024
1 parent db0dbb3 commit 225d261
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <LibCore/Directory.h>
#include <LibCore/MimeData.h>
#include <LibCore/Resource.h>
#include <LibHTTP/HttpResponse.h>
#include <LibRequests/Request.h>
#include <LibRequests/RequestClient.h>
#include <LibWeb/Cookie/Cookie.h>
Expand Down Expand Up @@ -432,8 +433,8 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
else
error_builder.append("Load failed"sv);

if (status_code.has_value())
error_builder.appendff(" (status code: {})", *status_code);
if (status_code.has_value() && *status_code > 0)
error_builder.appendff(" (status: {} {})", *status_code, HTTP::HttpResponse::reason_phrase_for_code(*status_code));

log_failure(request, error_builder.string_view());
if (error_callback)
Expand Down

0 comments on commit 225d261

Please sign in to comment.