type handleErrors
This commit is contained in:
1 parent
501664509b
commit
9646e7dbdc
5 files changed
+21
-18
No files matched your search
@@ -1,18 +1,18 @@
|
||||
export interface AppErrorConfig {
|
||||
message: string;
|
||||
message?: string;
|
||||
status?: number;
|
||||
service?: string | null;
|
||||
method?: string | null;
|
||||
details?: unknown;
|
||||
service?: string;
|
||||
method?: string;
|
||||
details?: Record<string, unknown> | undefined;
|
||||
}
|
||||
|
||||
export class AppError extends Error {
|
||||
private status: number;
|
||||
private service: string | null;
|
||||
private method: string | null;
|
||||
private details: unknown;
|
||||
readonly status: number;
|
||||
readonly service: string;
|
||||
readonly method: string;
|
||||
readonly details: Record<string, unknown> | undefined;
|
||||
|
||||
constructor({ message, status = 500, service = null, method = null, details = null }: AppErrorConfig) {
|
||||
constructor({ message, status = 500, service = "unknownService", method = "unknownMethod", details = undefined }: AppErrorConfig) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
this.service = service;
|
||||
|
||||
Reference in new issue
Block a user