diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-14 04:17:24 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-14 04:17:24 +0900 |
| commit | e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0 (patch) | |
| tree | 021d39efbb8ec59d098e06603bf86dae670773e0 /src/server/api/stream | |
| parent | Update CHANGELOG.md (diff) | |
| download | sharkey-e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0.tar.gz sharkey-e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0.tar.bz2 sharkey-e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0.zip | |
Better error handling
Diffstat (limited to 'src/server/api/stream')
| -rw-r--r-- | src/server/api/stream/channels/games/reversi-game.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/server/api/stream/channels/games/reversi-game.ts b/src/server/api/stream/channels/games/reversi-game.ts index d708eae9f7..7c13666c51 100644 --- a/src/server/api/stream/channels/games/reversi-game.ts +++ b/src/server/api/stream/channels/games/reversi-game.ts @@ -43,7 +43,7 @@ export default class extends Channel { if (this.user == null) return; const game = await ReversiGames.findOne(this.gameId!); - if (game == null) throw 'game not found'; + if (game == null) throw new Error('game not found'); if (game.isStarted) return; if ((game.user1Id !== this.user.id) && (game.user2Id !== this.user.id)) return; @@ -67,7 +67,7 @@ export default class extends Channel { if (this.user == null) return; const game = await ReversiGames.findOne(this.gameId!); - if (game == null) throw 'game not found'; + if (game == null) throw new Error('game not found'); if (game.isStarted) return; if ((game.user1Id !== this.user.id) && (game.user2Id !== this.user.id)) return; @@ -91,7 +91,7 @@ export default class extends Channel { if (this.user == null) return; const game = await ReversiGames.findOne(this.gameId!); - if (game == null) throw 'game not found'; + if (game == null) throw new Error('game not found'); if (game.isStarted) return; if ((game.user1Id !== this.user.id) && (game.user2Id !== this.user.id)) return; @@ -135,7 +135,7 @@ export default class extends Channel { if (this.user == null) return; const game = await ReversiGames.findOne(this.gameId!); - if (game == null) throw 'game not found'; + if (game == null) throw new Error('game not found'); if (game.isStarted) return; @@ -237,7 +237,7 @@ export default class extends Channel { if (this.user == null) return; const game = await ReversiGames.findOne(this.gameId!); - if (game == null) throw 'game not found'; + if (game == null) throw new Error('game not found'); if (!game.isStarted) return; if (game.isEnded) return; @@ -304,7 +304,7 @@ export default class extends Channel { @autobind private async check(crc32: string) { const game = await ReversiGames.findOne(this.gameId!); - if (game == null) throw 'game not found'; + if (game == null) throw new Error('game not found'); if (!game.isStarted) return; |