1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:35:07 +00:00

LibWeb: Print unhandled rejections the same way as unhandled exceptions

This commit is contained in:
Luke Wilde 2022-06-27 19:53:22 +01:00 committed by Linus Groh
parent 62491cda0b
commit 1e36224321
3 changed files with 23 additions and 12 deletions

View file

@ -10,6 +10,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/PromiseRejectionEvent.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Page/Page.h>
@ -232,7 +233,7 @@ void EnvironmentSettingsObject::notify_about_rejected_promises(Badge<EventLoop>)
// This algorithm results in promise rejections being marked as handled or not handled. These concepts parallel handled and not handled script errors.
// If a rejection is still not handled after this, then the rejection may be reported to a developer console.
if (not_handled)
dbgln("WARNING: A promise was rejected without any handlers. promise={:p}, result={}", &promise, promise.result().to_string_without_side_effects());
HTML::print_error_from_value(promise.result(), ErrorInPromise::Yes);
}
});
}