show toast with stack on rejected promises

This commit is contained in:
ed 2021-09-14 00:42:46 +02:00
parent 0b52ccd200
commit b65bea2550
2 changed files with 11 additions and 1 deletions

View file

@ -1524,6 +1524,7 @@ function autoplay_blocked(seek) {
go.textContent = 'Play "' + fn + '"';
go.onclick = function (e) {
unblocked(e);
toast.hide();
if (mp.au !== mp.au_ogvjs)
// chrome 91 may permanently taint on a failed play()
// depending on win10 settings or something? idk

View file

@ -30,7 +30,16 @@ function esc(txt) {
});
}
window.onunhandledrejection = function (e) {
console.log("REJ: " + e.reason);
var err = e.reason;
try {
err += '\n' + e.reason.stack;
}
catch (e) { }
console.log("REJ: " + err);
try {
toast.warn(30, err);
}
catch (e) { }
};
try {
console.hist = [];