rename to core
This commit is contained in:
34
core/racing/domain/errors/RacingDomainError.ts
Normal file
34
core/racing/domain/errors/RacingDomainError.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { IDomainError, CommonDomainErrorKind } from '@gridpilot/shared/errors';
|
||||
|
||||
export abstract class RacingDomainError extends Error implements IDomainError<CommonDomainErrorKind> {
|
||||
readonly type = 'domain' as const;
|
||||
readonly context = 'racing-domain';
|
||||
abstract readonly kind: CommonDomainErrorKind;
|
||||
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
}
|
||||
}
|
||||
|
||||
export class RacingDomainValidationError
|
||||
extends RacingDomainError
|
||||
implements IDomainError<'validation'>
|
||||
{
|
||||
readonly kind = 'validation' as const;
|
||||
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
export class RacingDomainInvariantError
|
||||
extends RacingDomainError
|
||||
implements IDomainError<'invariant'>
|
||||
{
|
||||
readonly kind = 'invariant' as const;
|
||||
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user