Skip to content

Commit

Permalink
Merge pull request #2857 from MonstraG/patch-yotuube-external-script
Browse files Browse the repository at this point in the history
fix: don't throw if loading youtube script fails
  • Loading branch information
Azmoria authored Feb 3, 2025
2 parents 70e9cbd + 7ceeeef commit d35e4c5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,13 @@ function load_external_script(scriptUrl) {
return new Promise(function (resolve, reject) {
let script = document.createElement('script');
script.src = scriptUrl;
script.addEventListener('error', function () {
reject(console.warn(`Failed to load external script ${scriptUrl}`));
script.addEventListener('error', err => {
reject(err);
});
script.addEventListener('load', resolve);
document.head.appendChild(script);
}).catch((err) => {
console.error(`Failed to load external script`, scriptUrl, err);
})
}

Expand Down

0 comments on commit d35e4c5

Please sign in to comment.