Skip to content

Commit

Permalink
created custom errors
Browse files Browse the repository at this point in the history
  • Loading branch information
seditionist committed Aug 17, 2023
1 parent 7bdde9f commit d67ffa3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,38 @@ export const FORMATTED_RIFTS_CLOSED = 'Rifts closed';

export const INVALID_FORMAT_ERROR = 'Invalid hiscores format';
export const PLAYER_NOT_FOUND_ERROR = 'Player not found';
export class InvalidFormatError extends Error {
__proto__ = Error;

constructor() {
super('Invalid hiscores format');
Object.setPrototypeOf(this, InvalidFormatError.prototype);
}
}

export class InvalidRSNError extends Error {
__proto__ = Error;

constructor(message: string) {
super(message);
Object.setPrototypeOf(this, InvalidRSNError.prototype);
}
}

export class PlayerNotFoundError extends Error {
__proto__ = Error;

constructor() {
super('Player not found');
Object.setPrototypeOf(this, PlayerNotFoundError.prototype);
}
}

export class HiScoresError extends Error {
__proto__ = Error;

constructor() {
super('HiScores not responding');
Object.setPrototypeOf(this, HiScoresError.prototype);
}
}

0 comments on commit d67ffa3

Please sign in to comment.