fix issues in core
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Designed for fast, common penalty scenarios like track limits, warnings, etc.
|
||||
*/
|
||||
|
||||
import { Penalty } from '../../domain/entities/Penalty';
|
||||
import { Penalty } from '../../domain/entities/penalty/Penalty';
|
||||
import type { IPenaltyRepository } from '../../domain/repositories/IPenaltyRepository';
|
||||
import type { IRaceRepository } from '../../domain/repositories/IRaceRepository';
|
||||
import type { ILeagueMembershipRepository } from '../../domain/repositories/ILeagueMembershipRepository';
|
||||
@@ -74,7 +74,11 @@ export class QuickPenaltyUseCase {
|
||||
);
|
||||
|
||||
if (!penaltyMapping) {
|
||||
this.logger.error('Unknown infraction type', { infractionType: input.infractionType, severity: input.severity });
|
||||
this.logger.error(
|
||||
'Unknown infraction type',
|
||||
undefined,
|
||||
{ infractionType: input.infractionType, severity: input.severity },
|
||||
);
|
||||
return Result.err({ code: 'UNKNOWN_INFRACTION', details: { message: 'Unknown infraction type' } });
|
||||
}
|
||||
|
||||
@@ -111,9 +115,16 @@ export class QuickPenaltyUseCase {
|
||||
|
||||
this.logger.info('Quick penalty applied successfully', { penaltyId: penalty.id, raceId: input.raceId, driverId: input.driverId });
|
||||
return Result.ok(undefined);
|
||||
} catch (error) {
|
||||
this.logger.error('Failed to apply quick penalty', { error: error instanceof Error ? error.message : 'Unknown error' });
|
||||
return Result.err({ code: 'REPOSITORY_ERROR', details: { message: error instanceof Error ? error.message : 'Unknown error' } });
|
||||
} catch (error: unknown) {
|
||||
const err =
|
||||
error instanceof Error ? error : new Error('Failed to apply quick penalty');
|
||||
|
||||
this.logger.error('Failed to apply quick penalty', err);
|
||||
|
||||
return Result.err({
|
||||
code: 'REPOSITORY_ERROR',
|
||||
details: { message: err.message },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user