wip
This commit is contained in:
14
packages/shared/errors/ApplicationError.ts
Normal file
14
packages/shared/errors/ApplicationError.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export type CommonApplicationErrorKind =
|
||||
| 'not_found'
|
||||
| 'forbidden'
|
||||
| 'conflict'
|
||||
| 'validation'
|
||||
| 'unknown'
|
||||
| string;
|
||||
|
||||
export interface IApplicationError<K extends string = CommonApplicationErrorKind, D = unknown> extends Error {
|
||||
readonly type: 'application';
|
||||
readonly context: string;
|
||||
readonly kind: K;
|
||||
readonly details?: D;
|
||||
}
|
||||
7
packages/shared/errors/DomainError.ts
Normal file
7
packages/shared/errors/DomainError.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export type CommonDomainErrorKind = 'validation' | 'invariant' | string;
|
||||
|
||||
export interface IDomainError<K extends string = CommonDomainErrorKind> extends Error {
|
||||
readonly type: 'domain';
|
||||
readonly context: string;
|
||||
readonly kind: K;
|
||||
}
|
||||
2
packages/shared/errors/index.ts
Normal file
2
packages/shared/errors/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './DomainError';
|
||||
export * from './ApplicationError';
|
||||
Reference in New Issue
Block a user