LibWeb: Log failed Fetch responses when WEB_FETCH_DEBUG is enabled

We do the same for successful responses. Very useful for debugging
issues on live websites.
This commit is contained in:
Timothy Flynn 2024-03-13 16:09:27 -04:00 committed by Andreas Kling
parent eb0d56a4ed
commit 7681772b9f
Notes: sideshowbarker 2024-07-18 00:41:35 +09:00

View File

@ -1779,6 +1779,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_load
},
[&realm, &vm, request, pending_response](auto& error, auto status_code, auto data, auto& response_headers) {
dbgln_if(WEB_FETCH_DEBUG, "Fetch: ResourceLoader load for '{}' failed: {} (status {})", request->url(), error, status_code.value_or(0));
if constexpr (WEB_FETCH_DEBUG)
log_response(status_code, response_headers, data);
auto response = Infrastructure::Response::create(vm);
// FIXME: This is ugly, ResourceLoader should tell us.
if (status_code.value_or(0) == 0) {