@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 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
- app,
26
+ plugins,
26
27
  runApp,
27
28
  define,
28
29
  utils,
package/lib/plugins.ts ADDED
@@ -0,0 +1,7 @@
1
+ type plugins = {
2
+ [key: string]: any;
3
+ sentry?: any;
4
+ };
5
+ const plugins: plugins = {};
6
+
7
+ export { plugins };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.74.4",
3
+ "version": "0.74.6",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {},
package/types/index.ts CHANGED
@@ -628,7 +628,7 @@ export type Config = {
628
628
  };
629
629
  clusterMode?: boolean;
630
630
  api?: {
631
- onError?: (error: ApiError) => Promise<ApiError> | ApiError | void;
631
+ onError?: (errorFormated: ApiError,err?:Error) => Promise<ApiError> | ApiError | void;
632
632
  };
633
633
  server: {
634
634
  name?: string;