stashing code
This commit is contained in:
24
packages/result/index.ts
Normal file
24
packages/result/index.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export const ERROR_CODES = {
|
||||
API_ERROR: "API_ERROR",
|
||||
DATABASE_ERROR: "DATABASE_ERROR",
|
||||
NETWORK_ERROR: "NETWORK_ERROR",
|
||||
AUTH_ERROR: "AUTH_ERROR",
|
||||
PERMISSION_ERROR: "PERMISSION_ERROR",
|
||||
VALIDATION_ERROR: "VALIDATION_ERROR",
|
||||
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
||||
NOT_FOUND_ERROR: "NOT_FOUND_ERROR",
|
||||
INPUT_ERROR: "INPUT_ERROR",
|
||||
INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR",
|
||||
EXTERNAL_SERVICE_ERROR: "EXTERNAL_SERVICE_ERROR",
|
||||
} as const;
|
||||
|
||||
export type Err = {
|
||||
code: string;
|
||||
message: string;
|
||||
userHint: string;
|
||||
detail: string;
|
||||
actionable?: boolean;
|
||||
error?: any;
|
||||
};
|
||||
|
||||
export type Result<T> = { data?: T; error?: Err };
|
||||
Reference in New Issue
Block a user