@dnax/core 0.74.4 → 0.74.6
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/app/hono.ts +5 -1
- package/index.ts +2 -1
- package/lib/plugins.ts +7 -0
- package/package.json +1 -1
- package/types/index.ts +1 -1
package/app/hono.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { consola } from "consola";
|
|
|
16
16
|
import { cors } from "hono/cors";
|
|
17
17
|
import { asyncLocalStorage, sessionStorage } from "../lib/asyncLocalStorage";
|
|
18
18
|
import { crypt } from "../lib/crypto";
|
|
19
|
+
import { plugins } from "../lib/plugins";
|
|
19
20
|
import {
|
|
20
21
|
cleanPath,
|
|
21
22
|
ContextError,
|
|
@@ -793,7 +794,7 @@ function HonoInstance(): typeof app {
|
|
|
793
794
|
};
|
|
794
795
|
if (Cfg?.api?.onError && typeof Cfg?.api?.onError == "function") {
|
|
795
796
|
try {
|
|
796
|
-
await Cfg?.api?.onError(errorFormated);
|
|
797
|
+
await Cfg?.api?.onError(errorFormated, err);
|
|
797
798
|
} catch (e) {}
|
|
798
799
|
}
|
|
799
800
|
return c.json(errorFormated);
|
|
@@ -904,6 +905,9 @@ function HonoInstance(): typeof app {
|
|
|
904
905
|
|
|
905
906
|
app.onError((err, c) => {
|
|
906
907
|
// console.error(err?.message);
|
|
908
|
+
if (plugins?.sentry) {
|
|
909
|
+
plugins?.sentry?.captureException(err) ?? null;
|
|
910
|
+
}
|
|
907
911
|
c.status(500);
|
|
908
912
|
return c.json({ message: err?.message });
|
|
909
913
|
});
|
package/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import * as utils from "./utils";
|
|
|
9
9
|
import { app } from "./app/hono";
|
|
10
10
|
import { FilesystemSftpAdapter, MinioAdapter } from "./lib/media";
|
|
11
11
|
import { crypt } from "./lib/crypto";
|
|
12
|
+
import { plugins } from "./lib/plugins";
|
|
12
13
|
import { contextStorage } from "./lib/asyncLocalStorage";
|
|
13
14
|
import { Cron as Task } from "croner";
|
|
14
15
|
import { serveStatic } from "hono/bun";
|
|
@@ -22,7 +23,7 @@ const Adapter = {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
+
plugins,
|
|
26
27
|
runApp,
|
|
27
28
|
define,
|
|
28
29
|
utils,
|
package/lib/plugins.ts
ADDED
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -628,7 +628,7 @@ export type Config = {
|
|
|
628
628
|
};
|
|
629
629
|
clusterMode?: boolean;
|
|
630
630
|
api?: {
|
|
631
|
-
onError?: (
|
|
631
|
+
onError?: (errorFormated: ApiError,err?:Error) => Promise<ApiError> | ApiError | void;
|
|
632
632
|
};
|
|
633
633
|
server: {
|
|
634
634
|
name?: string;
|