From f61e3a4e5abd4b6e21d62b6bdcbd66353dc46174 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 16 Dec 2025 18:21:41 +0100 Subject: [PATCH] refactor --- .../dto/GetEntitySponsorshipPricingResultDTO.ts | 2 +- core/shared/errors/ApplicationError.ts | 17 ++++++++++------- core/shared/errors/ApplicationErrorCode.ts | 6 ++++++ 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 core/shared/errors/ApplicationErrorCode.ts diff --git a/core/racing/application/dto/GetEntitySponsorshipPricingResultDTO.ts b/core/racing/application/dto/GetEntitySponsorshipPricingResultDTO.ts index 452051879..ae9de119d 100644 --- a/core/racing/application/dto/GetEntitySponsorshipPricingResultDTO.ts +++ b/core/racing/application/dto/GetEntitySponsorshipPricingResultDTO.ts @@ -1,5 +1,5 @@ import type { SponsorableEntityType } from '../../domain/entities/SponsorshipRequest'; -import type { SponsorshipSlotDTO } from '../use-cases/SponsorshipSlotDTO'; +import type { SponsorshipSlotDTO } from './SponsorshipSlotDTO'; export interface GetEntitySponsorshipPricingResultDTO { entityType: SponsorableEntityType; diff --git a/core/shared/errors/ApplicationError.ts b/core/shared/errors/ApplicationError.ts index 6a6cdcc54..0a2de0c2a 100644 --- a/core/shared/errors/ApplicationError.ts +++ b/core/shared/errors/ApplicationError.ts @@ -1,14 +1,17 @@ /** - * @deprecated Use error codes in Result instead of throwing ApplicationError. + * @deprecated Use ApplicationErrorCode in Result instead of throwing ApplicationError. */ export type CommonApplicationErrorKind = - | 'not_found' - | 'forbidden' - | 'conflict' - | 'validation' - | 'unknown' - | string; +| 'not_found' +| 'forbidden' +| 'conflict' +| 'validation' +| 'unknown' +| string; +/** + * @deprecated Use ApplicationErrorCode in Result instead of throwing ApplicationError. + */ export interface IApplicationError extends Error { readonly type: 'application'; readonly context: string; diff --git a/core/shared/errors/ApplicationErrorCode.ts b/core/shared/errors/ApplicationErrorCode.ts new file mode 100644 index 000000000..ba652fb7b --- /dev/null +++ b/core/shared/errors/ApplicationErrorCode.ts @@ -0,0 +1,6 @@ +export type ApplicationErrorCode< + Code extends string, + Details = undefined +> = Details extends undefined + ? { code: Code } + : { code: Code; details: Details }; \ No newline at end of file