This commit is contained in:
2025-12-11 11:25:22 +01:00
parent 6a427eab57
commit e4c1be628d
86 changed files with 1222 additions and 736 deletions

View File

@@ -5,6 +5,8 @@
* Immutable entity with factory methods and domain validation.
*/
import { RacingDomainValidationError } from '../errors/RacingDomainError';
export class Standing {
readonly leagueId: string;
readonly driverId: string;
@@ -60,11 +62,11 @@ export class Standing {
driverId: string;
}): void {
if (!props.leagueId || props.leagueId.trim().length === 0) {
throw new Error('League ID is required');
throw new RacingDomainError('League ID is required');
}
if (!props.driverId || props.driverId.trim().length === 0) {
throw new Error('Driver ID is required');
throw new RacingDomainError('Driver ID is required');
}
}
@@ -90,7 +92,7 @@ export class Standing {
*/
updatePosition(position: number): Standing {
if (!Number.isInteger(position) || position < 1) {
throw new Error('Position must be a positive integer');
throw new RacingDomainError('Position must be a positive integer');
}
return new Standing({