web: Show the original cause of the error when Ruffle fails to load

This commit is contained in:
Daniel Jacobs 2024-09-18 10:18:48 -04:00
parent f82f58f28a
commit 6f8902354f
1 changed files with 3 additions and 1 deletions

View File

@ -1835,6 +1835,7 @@ export class InnerPlayer {
}
this.panicked = true;
this.hideSplashScreen();
const originalError = error;
if (
error instanceof Error &&
@ -1854,6 +1855,7 @@ export class InnerPlayer {
this.addOpenInNewTabMessage(openInNewTab, swfUrl);
return;
}
error = error.cause;
}
const errorArray: Array<string | null> & {
@ -1892,7 +1894,7 @@ export class InnerPlayer {
errorArray.push(this.getPanicData());
// Clears out any existing content (ie play button or canvas) and replaces it with the error screen
showPanicScreen(this.container, error, errorArray, this.swfUrl);
showPanicScreen(this.container, originalError, errorArray, this.swfUrl);
// Do this last, just in case it causes any cascading issues.
this.destroy();