milkio 0.0.34 → 0.0.35

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "milkio",
3
3
  "type": "module",
4
4
  "module": "index.ts",
5
- "version": "0.0.34",
5
+ "version": "0.0.35",
6
6
  "peerDependencies": {
7
7
  "typescript": "^5.4.2"
8
8
  },
@@ -1,17 +1,22 @@
1
1
  import { failCode } from "../../../src/fail-code"
2
2
  import { useLogger, type ExecuteId, type ExecuteResult } from ".."
3
+ import { configMilkio } from "../../../src/config/milkio"
3
4
 
4
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
6
  export function hanldeCatchError(error: any, executeId: ExecuteId): ExecuteResult<any> {
6
7
  const logger = useLogger(executeId)
7
8
 
8
- logger.error("\nError Data: " + JSON.stringify(error))
9
- if (error.stack) logger.error("\nError Stack: ", error.stack)
10
- else logger.error("\nError Stack: ", error)
9
+ if (configMilkio.debug === true) {
10
+ logger.error("\nError Data: " + JSON.stringify(error))
11
+ if (error.stack) logger.error("\nError Stack: ", error.stack)
12
+ else logger.error("\nError Stack: ", error)
13
+ }
11
14
 
12
15
  if (error.name !== "MilkioReject") {
13
- // If it is not MilkioReject, it is considered an internal server error that should not be exposed
14
- logger.error(`FailCode: INTERNAL_SERVER_ERROR`)
16
+ if (configMilkio.debug === true) {
17
+ // If it is not MilkioReject, it is considered an internal server error that should not be exposed
18
+ logger.error(`FailCode: INTERNAL_SERVER_ERROR`)
19
+ }
15
20
 
16
21
  return {
17
22
  executeId,
@@ -23,7 +28,10 @@ export function hanldeCatchError(error: any, executeId: ExecuteId): ExecuteResul
23
28
  }
24
29
  }
25
30
  } else {
26
- logger.error(`FailCode: ${error.code}`)
31
+ if (configMilkio.debug === true) {
32
+ logger.error(`FailCode: ${error.code}`)
33
+ }
34
+
27
35
  return {
28
36
  executeId,
29
37
  success: false,