mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-05 05:56:53 +03:00
LibWeb/ResourceLoader: Report file: errors as "network errors"
This triggers the generated error page which is more informative.
This commit is contained in:
parent
e35b055192
commit
91e3ef6dbf
Notes:
sideshowbarker
2024-07-17 08:42:05 +09:00
Author: https://github.com/circl-lastname Commit: https://github.com/LadybirdBrowser/ladybird/commit/91e3ef6dbf Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/209 Reviewed-by: https://github.com/ADKaster ✅
@ -334,10 +334,8 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
|
||||
|
||||
if (file_or_error.is_error()) {
|
||||
log_failure(request, file_or_error.error());
|
||||
if (error_callback) {
|
||||
auto status = file_or_error.error().code() == ENOENT ? 404u : 500u;
|
||||
error_callback(ByteString::formatted("{}", file_or_error.error()), status, {}, {});
|
||||
}
|
||||
if (error_callback)
|
||||
error_callback(ByteString::formatted("{}", file_or_error.error()), {}, {}, {});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -354,7 +352,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
|
||||
if (st_or_error.is_error()) {
|
||||
log_failure(request, st_or_error.error());
|
||||
if (error_callback)
|
||||
error_callback(ByteString::formatted("{}", st_or_error.error()), 500u, {}, {});
|
||||
error_callback(ByteString::formatted("{}", st_or_error.error()), {}, {}, {});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -363,7 +361,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
|
||||
if (maybe_file.is_error()) {
|
||||
log_failure(request, maybe_file.error());
|
||||
if (error_callback)
|
||||
error_callback(ByteString::formatted("{}", maybe_file.error()), 500u, {}, {});
|
||||
error_callback(ByteString::formatted("{}", maybe_file.error()), {}, {}, {});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -372,7 +370,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
|
||||
if (maybe_data.is_error()) {
|
||||
log_failure(request, maybe_data.error());
|
||||
if (error_callback)
|
||||
error_callback(ByteString::formatted("{}", maybe_data.error()), 500u, {}, {});
|
||||
error_callback(ByteString::formatted("{}", maybe_data.error()), {}, {}, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user