erpnext-queue-client 1.19.7 → 1.19.8

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.
@@ -4,18 +4,27 @@ exports.validateData = validateData;
4
4
  exports.pickFromSchema = pickFromSchema;
5
5
  const zod_1 = require("zod");
6
6
  const constants_1 = require("../constants");
7
+ const logger_1 = require("./logger");
7
8
  function validateData(data, ValidationModel) {
8
9
  if (!ValidationModel.description)
9
10
  throw new Error("ValidationModel.description is required");
10
11
  const validationResult = ValidationModel.safeParse(data);
11
12
  if (!validationResult.success) {
12
- throw {
13
+ const errorObject = {
13
14
  message: `Validation error in model ${ValidationModel.description}`,
14
15
  error: validationResult.error,
15
16
  input: constants_1.constants.DEBUG_MODE === "true"
16
17
  ? data
17
18
  : "set DEBUG_MODE to true to see the input",
18
19
  };
20
+ if (data &&
21
+ typeof data === "object" &&
22
+ "message" in data &&
23
+ typeof data.message === "string") {
24
+ logger_1.lg.error(errorObject);
25
+ throw new Error(data.message);
26
+ }
27
+ throw errorObject;
19
28
  }
20
29
  return validationResult.data;
21
30
  }
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "winston": "^3.15.0",
26
26
  "zod": "3.24.1"
27
27
  },
28
- "version": "1.19.7",
28
+ "version": "1.19.8",
29
29
  "devDependencies": {
30
30
  "@types/crypto-js": "^4.2.2",
31
31
  "@types/lodash": "^4.17.13",