Better error message in case of 404

This commit is contained in:
David Négrier 2021-01-17 22:40:54 +01:00
parent 48c3f951bf
commit 4234b38910
4 changed files with 58 additions and 6 deletions

View file

@ -1,7 +1,7 @@
import {gameManager} from "../Game/GameManager";
import {Scene} from "phaser";
import {handleAxiosError} from "../../Network/axios";
import {ErrorScene} from "../Reconnecting/ErrorScene";
import {WAError} from "../Reconnecting/WAError";
export const EntrySceneName = "EntryScene";
@ -20,7 +20,11 @@ export class EntryScene extends Scene {
gameManager.init(this.scene).then((nextSceneName) => {
this.scene.start(nextSceneName);
}).catch((err) => {
ErrorScene.showError(err, this.scene);
if (err.response && err.response.status == 404) {
ErrorScene.showError(new WAError('Page Not Found', 'Could not find map', window.location.pathname), this.scene);
} else {
ErrorScene.showError(err, this.scene);
}
});
}
}