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

@@ -1,9 +1,11 @@
/**
* Domain Value Object: LeagueName
*
*
* Represents a valid league name with validation rules.
*/
import { RacingDomainValidationError } from '../errors/RacingDomainError';
export interface LeagueNameValidationResult {
valid: boolean;
error?: string;
@@ -76,7 +78,7 @@ export class LeagueName {
static create(value: string): LeagueName {
const validation = this.validate(value);
if (!validation.valid) {
throw new Error(validation.error);
throw new RacingDomainValidationError(validation.error ?? 'Invalid league name');
}
return new LeagueName(value.trim());
}