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

@@ -51,39 +51,39 @@ export class LiveryDecal {
private static validate(props: LiveryDecalProps): void {
if (!props.id || props.id.trim().length === 0) {
throw new Error('LiveryDecal ID is required');
throw new RacingDomainValidationError('LiveryDecal ID is required');
}
if (!props.imageUrl || props.imageUrl.trim().length === 0) {
throw new Error('LiveryDecal imageUrl is required');
throw new RacingDomainValidationError('LiveryDecal imageUrl is required');
}
if (props.x < 0 || props.x > 1) {
throw new Error('LiveryDecal x coordinate must be between 0 and 1 (normalized)');
throw new RacingDomainValidationError('LiveryDecal x coordinate must be between 0 and 1 (normalized)');
}
if (props.y < 0 || props.y > 1) {
throw new Error('LiveryDecal y coordinate must be between 0 and 1 (normalized)');
throw new RacingDomainValidationError('LiveryDecal y coordinate must be between 0 and 1 (normalized)');
}
if (props.width <= 0 || props.width > 1) {
throw new Error('LiveryDecal width must be between 0 and 1 (normalized)');
throw new RacingDomainValidationError('LiveryDecal width must be between 0 and 1 (normalized)');
}
if (props.height <= 0 || props.height > 1) {
throw new Error('LiveryDecal height must be between 0 and 1 (normalized)');
throw new RacingDomainValidationError('LiveryDecal height must be between 0 and 1 (normalized)');
}
if (!Number.isInteger(props.zIndex) || props.zIndex < 0) {
throw new Error('LiveryDecal zIndex must be a non-negative integer');
throw new RacingDomainValidationError('LiveryDecal zIndex must be a non-negative integer');
}
if (props.rotation < 0 || props.rotation > 360) {
throw new Error('LiveryDecal rotation must be between 0 and 360 degrees');
throw new RacingDomainValidationError('LiveryDecal rotation must be between 0 and 360 degrees');
}
if (!props.type) {
throw new Error('LiveryDecal type is required');
throw new RacingDomainValidationError('LiveryDecal type is required');
}
}