@open-norantec/utilities 1.0.1-alpha.16 → 1.0.1-alpha.17

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,9 +4,14 @@ exports.ErrorUtil = void 0;
4
4
  const zod_1 = require("zod");
5
5
  class ErrorUtil {
6
6
  static getErrorMessage(error) {
7
- var _a, _b;
8
- if (error instanceof zod_1.ZodError)
9
- return ((_b = (_a = error === null || error === void 0 ? void 0 : error.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) || 'Validation error';
7
+ if (error instanceof zod_1.ZodError) {
8
+ try {
9
+ return `Parameters failed to pass validator rules: ${error.errors.map((subError) => subError.path.join('.')).join(', ')}`;
10
+ }
11
+ catch (_a) {
12
+ return 'Parameters validation error';
13
+ }
14
+ }
10
15
  return (error === null || error === void 0 ? void 0 : error.message) || 'An unknown error occurred';
11
16
  }
12
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/utilities",
3
- "version": "1.0.1-alpha.16",
3
+ "version": "1.0.1-alpha.17",
4
4
  "description": "NoranTec Utilities",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {