wip
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user