Spaces:
Running
Running
Download src/lib/errors.ts from risenetup/chess-monolith: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/risenetup/chess-monolith/resolve/main/src/lib/errors.ts
- Command line
-
hf download hf://spaces/risenetup/chess-monolith/src/lib/errors.ts
-
curl -L -o errors.ts https://huggingface.co/spaces/risenetup/chess-monolith/resolve/main/src/lib/errors.ts
1.01 kB
| export class DomainError extends Error { | |
| constructor( | |
| public readonly userMessage: string, | |
| internalMessage?: string, | |
| ) { | |
| super(internalMessage ?? userMessage); | |
| this.name = "DomainError"; | |
| } | |
| } | |
| export class GameNotFoundError extends DomainError { | |
| constructor(gameId: string) { | |
| super( | |
| "Game not found", | |
| `Game not found or corrupted state for gameId: ${gameId}`, | |
| ); | |
| this.name = "GameNotFoundError"; | |
| } | |
| } | |
| export class NotYourTurnError extends DomainError { | |
| constructor() { | |
| super("Not your turn"); | |
| this.name = "NotYourTurnError"; | |
| } | |
| } | |
| export class TimeExpiredError extends DomainError { | |
| constructor() { | |
| super("Time expired"); | |
| this.name = "TimeExpiredError"; | |
| } | |
| } | |
| export class IllegalMoveError extends DomainError { | |
| constructor() { | |
| super("Illegal move"); | |
| this.name = "IllegalMoveError"; | |
| } | |
| } | |
| export class AuthError extends DomainError { | |
| constructor(message = "Unauthorized") { | |
| super(message); | |
| this.name = "AuthError"; | |
| } | |
| } | |