Skip to content

Commit

Permalink
Use base error
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybaloney committed Apr 7, 2024
1 parent b9f6704 commit e44f8f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/panel/basepettype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import {
FrameResult,
} from './states';

export class InvalidStateException {
export class InvalidStateError extends Error {
fromState: States;
petType: string;

constructor(fromState: States, petType: string) {
super(`Invalid state ${fromState} for pet type ${petType}`);
this.fromState = fromState;
this.petType = petType;
}
Expand Down Expand Up @@ -250,7 +251,7 @@ export abstract class BasePetType implements IPetType {
}
}
if (!possibleNextStates) {
throw new InvalidStateException(fromState, this.label);
throw new InvalidStateError(fromState, this.label);
}
// randomly choose the next state
const idx = Math.floor(Math.random() * possibleNextStates.length);
Expand Down

0 comments on commit e44f8f1

Please sign in to comment.