mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
Catch errors and rejected promises.
This commit is contained in:
parent
14cc639654
commit
b67b9efc31
@ -889,6 +889,8 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
let battleConfig: FixedBattleConfig = null;
|
let battleConfig: FixedBattleConfig = null;
|
||||||
|
|
||||||
|
throw new Error('JLIN not implemented.');
|
||||||
|
|
||||||
this.resetSeed(newWaveIndex);
|
this.resetSeed(newWaveIndex);
|
||||||
|
|
||||||
const playerField = this.getPlayerField();
|
const playerField = this.getPlayerField();
|
||||||
|
15
src/main.ts
15
src/main.ts
@ -9,6 +9,21 @@ import BBCodeText from 'phaser3-rex-plugins/plugins/bbcodetext';
|
|||||||
import TransitionImagePackPlugin from 'phaser3-rex-plugins/templates/transitionimagepack/transitionimagepack-plugin.js';
|
import TransitionImagePackPlugin from 'phaser3-rex-plugins/templates/transitionimagepack/transitionimagepack-plugin.js';
|
||||||
import { LoadingScene } from './loading-scene';
|
import { LoadingScene } from './loading-scene';
|
||||||
|
|
||||||
|
|
||||||
|
// Catch global errors and display them in an alert so users can report the issue.
|
||||||
|
window.onerror = function (message, source, lineno, colno, error) {
|
||||||
|
console.error(error);
|
||||||
|
let errorString = `Received unhandled error. Open browser console and click OK to see details.\nError: ${message}\nSource: ${source}\nLine: ${lineno}\nColumn: ${colno}\nStack: ${error.stack}`;
|
||||||
|
alert(errorString);
|
||||||
|
// Avoids logging the error a second time.
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('unhandledrejection', (event) => {
|
||||||
|
let errorString = `Received unhandled promise rejection. Open browser console and click OK to see details.\nReason: ${event.reason}`;
|
||||||
|
alert(errorString);
|
||||||
|
});
|
||||||
|
|
||||||
const config: Phaser.Types.Core.GameConfig = {
|
const config: Phaser.Types.Core.GameConfig = {
|
||||||
type: Phaser.WEBGL,
|
type: Phaser.WEBGL,
|
||||||
parent: 'app',
|
parent: 'app',
|
||||||
|
@ -330,6 +330,8 @@ export class TitlePhase extends Phase {
|
|||||||
this.scene.sessionPlayTime = 0;
|
this.scene.sessionPlayTime = 0;
|
||||||
this.end();
|
this.end();
|
||||||
});
|
});
|
||||||
|
}).catch(err => {
|
||||||
|
console.error("Failed to load daily run:\n", err);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
|
|||||||
} else
|
} else
|
||||||
this.loadingLabel.setText('No Rankings');
|
this.loadingLabel.setText('No Rankings');
|
||||||
});
|
});
|
||||||
});
|
}).catch(err => { console.error("Failed to load daily rankings:\n", err) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,9 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||||||
this.playerCountLabel.setText(`${stats.playerCount} Players Online`);
|
this.playerCountLabel.setText(`${stats.playerCount} Players Online`);
|
||||||
if (this.splashMessage === battleCountSplashMessage)
|
if (this.splashMessage === battleCountSplashMessage)
|
||||||
this.splashMessageText.setText(battleCountSplashMessage.replace('{COUNT}', stats.battleCount.toLocaleString('en-US')));
|
this.splashMessageText.setText(battleCountSplashMessage.replace('{COUNT}', stats.battleCount.toLocaleString('en-US')));
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error("Failed to fetch title stats:\n", err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user