@alevnyacow/nzmt 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Rslib project
2
+
3
+ ## Setup
4
+
5
+ Install the dependencies:
6
+
7
+ ```bash
8
+ npm install
9
+ ```
10
+
11
+ ## Get started
12
+
13
+ Build the library:
14
+
15
+ ```bash
16
+ npm run build
17
+ ```
18
+
19
+ Build the library in watch mode:
20
+
21
+ ```bash
22
+ npm run dev
23
+ ```
@@ -0,0 +1,41 @@
1
+ export type ErrorBaseCreatingPayload = {
2
+ error: unknown;
3
+ code?: string;
4
+ details?: any;
5
+ };
6
+ export type ErrorBaseModel = {
7
+ name: string;
8
+ message: string;
9
+ code: string;
10
+ timestamp: number;
11
+ details: any | null;
12
+ };
13
+ export type ModuleErrorModel = ErrorBaseModel & {
14
+ module: string;
15
+ method: string;
16
+ cause: ErrorBaseModel | null;
17
+ };
18
+ export type ControllerErrorModel = ErrorBaseModel & {
19
+ module: string;
20
+ method: string;
21
+ cause: ModuleErrorModel | ErrorBaseModel | null;
22
+ statusCode: number;
23
+ };
24
+ export declare class ErrorFactory {
25
+ static isControllerError: (error: unknown) => error is ControllerErrorModel;
26
+ static isModuleError: (arg: any) => arg is ModuleErrorModel;
27
+ private static base;
28
+ static forModule: (serviceName: string) => {
29
+ inMethod: (methodName: string) => {
30
+ newError: (payload: ErrorBaseCreatingPayload, cause?: unknown) => ModuleErrorModel;
31
+ };
32
+ };
33
+ static forController: (controllerName: string) => {
34
+ inMethod: (methodName: string) => {
35
+ newError: (payload: ErrorBaseCreatingPayload & {
36
+ statusCode: number;
37
+ }, cause?: unknown) => ControllerErrorModel;
38
+ };
39
+ };
40
+ static fromUnknownError: (error: unknown) => ErrorBaseModel | ModuleErrorModel;
41
+ }