Stopping sending literal errors
Errors now must be of "Error" type. Rule added in eslint.
This commit is contained in:
parent
88509916a8
commit
ab0f5e9837
19 changed files with 31 additions and 28 deletions
|
@ -90,7 +90,7 @@ export const getRessourceDescriptor = (
|
|||
const playerResource = LAYERS[i][textureName];
|
||||
if (playerResource !== undefined) return playerResource;
|
||||
}
|
||||
throw "Could not find a data for texture " + textureName;
|
||||
throw new Error("Could not find a data for texture " + textureName);
|
||||
};
|
||||
|
||||
export const createLoadingPromise = (
|
||||
|
|
|
@ -66,7 +66,7 @@ export class GameManager {
|
|||
|
||||
getCharacterLayers(): string[] {
|
||||
if (!this.characterLayers) {
|
||||
throw "characterLayers are not set";
|
||||
throw new Error("characterLayers are not set");
|
||||
}
|
||||
return this.characterLayers;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ export class GameManager {
|
|||
* This will close the socket connections and stop the gameScene, but won't remove it.
|
||||
*/
|
||||
leaveGame(targetSceneName: string, sceneClass: Phaser.Scene): void {
|
||||
if (this.currentGameSceneName === null) throw "No current scene id set!";
|
||||
if (this.currentGameSceneName === null) throw new Error("No current scene id set!");
|
||||
const gameScene: GameScene = this.scenePlugin.get(this.currentGameSceneName) as GameScene;
|
||||
gameScene.cleanupClosingScene();
|
||||
gameScene.createSuccessorGameScene(false, false);
|
||||
|
@ -143,7 +143,7 @@ export class GameManager {
|
|||
}
|
||||
|
||||
public getCurrentGameScene(): GameScene {
|
||||
if (this.currentGameSceneName === null) throw "No current scene id set!";
|
||||
if (this.currentGameSceneName === null) throw new Error("No current scene id set!");
|
||||
return this.scenePlugin.get(this.currentGameSceneName) as GameScene;
|
||||
}
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ export class GameScene extends DirtyScene {
|
|||
|
||||
const playerName = gameManager.getPlayerName();
|
||||
if (!playerName) {
|
||||
throw "playerName is not set";
|
||||
throw new Error("playerName is not set");
|
||||
}
|
||||
this.playerName = playerName;
|
||||
this.characterLayers = gameManager.getCharacterLayers();
|
||||
|
|
|
@ -48,7 +48,7 @@ export class CustomizeScene extends AbstractCharacterScene {
|
|||
bodyResourceDescription.level < 0 ||
|
||||
bodyResourceDescription.level > 5
|
||||
) {
|
||||
throw "Texture level is null";
|
||||
throw new Error("Texture level is null");
|
||||
}
|
||||
this.layers[bodyResourceDescription.level].unshift(bodyResourceDescription);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue