Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject browser js loader promise with Error object #7236

Merged
merged 9 commits into from Nov 23, 2021
7 changes: 5 additions & 2 deletions packages/runtimes/js/src/helpers/browser/js-loader.js
Expand Up @@ -18,10 +18,13 @@ module.exports = cacheLoader(function loadJSBundle(bundle) {
script.type = 'text/javascript';
script.charset = 'utf-8';
script.src = bundle;
script.onerror = function (e) {
script.onerror = function(e) {
var error = new TypeError(
mrkldshv marked this conversation as resolved.
Show resolved Hide resolved
`Failed to fetch dynamically imported module: ${bundle}.`,
);
mrkldshv marked this conversation as resolved.
Show resolved Hide resolved
script.onerror = script.onload = null;
script.remove();
reject(e);
reject(error);
};

script.onload = function () {
Expand Down