@arkyn/server 1.3.12 → 1.3.13
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/dist/helpers/getScopedParams.d.ts +0 -2
- package/dist/helpers/getScopedParams.d.ts.map +1 -1
- package/dist/helpers/globalErrorHandler.d.ts +1 -1
- package/dist/helpers/globalErrorHandler.d.ts.map +1 -1
- package/dist/helpers/globalErrorHandler.js +5 -1
- package/package.json +1 -1
- package/src/helpers/globalErrorHandler.ts +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getScopedParams.d.ts","sourceRoot":"","sources":["../../src/helpers/getScopedParams.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getScopedParams.d.ts","sourceRoot":"","sources":["../../src/helpers/getScopedParams.ts"],"names":[],"mappings":"AAAA,iBAAS,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,GAAE,MAAW,iCAW5D;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const globalErrorHandler: (error:
|
|
1
|
+
declare const globalErrorHandler: (error: any) => import("@remix-run/node").TypedResponse<import("@arkyn/types").HttpResponse>;
|
|
2
2
|
export { globalErrorHandler };
|
|
3
3
|
//# sourceMappingURL=globalErrorHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalErrorHandler.d.ts","sourceRoot":"","sources":["../../src/helpers/globalErrorHandler.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,kBAAkB,UAAW,
|
|
1
|
+
{"version":3,"file":"globalErrorHandler.d.ts","sourceRoot":"","sources":["../../src/helpers/globalErrorHandler.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,kBAAkB,UAAW,GAAG,iFAqBrC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -18,7 +18,11 @@ const globalErrorHandler = (error) => {
|
|
|
18
18
|
case error instanceof NotFoundError:
|
|
19
19
|
return json(notFound(error));
|
|
20
20
|
default:
|
|
21
|
-
return json(serverError(
|
|
21
|
+
return json(serverError({
|
|
22
|
+
message: error?.message || "Server error | Message not found",
|
|
23
|
+
name: "Server Error",
|
|
24
|
+
cause: error,
|
|
25
|
+
}));
|
|
22
26
|
}
|
|
23
27
|
};
|
|
24
28
|
export { globalErrorHandler };
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
UnauthorizedError,
|
|
11
11
|
} from "../httpBadResponses/unauthorized";
|
|
12
12
|
|
|
13
|
-
const globalErrorHandler = (error:
|
|
13
|
+
const globalErrorHandler = (error: any) => {
|
|
14
14
|
switch (true) {
|
|
15
15
|
case error instanceof BadRequestError:
|
|
16
16
|
return json(badRequest(error));
|
|
@@ -23,7 +23,13 @@ const globalErrorHandler = (error: Error) => {
|
|
|
23
23
|
case error instanceof NotFoundError:
|
|
24
24
|
return json(notFound(error));
|
|
25
25
|
default:
|
|
26
|
-
return json(
|
|
26
|
+
return json(
|
|
27
|
+
serverError({
|
|
28
|
+
message: error?.message || "Server error | Message not found",
|
|
29
|
+
name: "Server Error",
|
|
30
|
+
cause: error,
|
|
31
|
+
})
|
|
32
|
+
);
|
|
27
33
|
}
|
|
28
34
|
};
|
|
29
35
|
|