@open-norantec/utilities 1.0.1-alpha.11 → 1.0.1-alpha.12

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.
@@ -0,0 +1,3 @@
1
+ export declare class ErrorUtil {
2
+ static getErrorMessage(error: Error): string;
3
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorUtil = void 0;
4
+ const zod_1 = require("zod");
5
+ class ErrorUtil {
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';
10
+ return (error === null || error === void 0 ? void 0 : error.message) || 'An unknown error occurred';
11
+ }
12
+ }
13
+ exports.ErrorUtil = ErrorUtil;
package/dist/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from './log-util.class';
10
10
  export * from './crypto-util.class';
11
11
  export * from './date-util.class';
12
12
  export * from './url-util.class';
13
+ export * from './error-util.class';
package/dist/index.js CHANGED
@@ -26,3 +26,4 @@ __exportStar(require("./log-util.class"), exports);
26
26
  __exportStar(require("./crypto-util.class"), exports);
27
27
  __exportStar(require("./date-util.class"), exports);
28
28
  __exportStar(require("./url-util.class"), exports);
29
+ __exportStar(require("./error-util.class"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/utilities",
3
- "version": "1.0.1-alpha.11",
3
+ "version": "1.0.1-alpha.12",
4
4
  "description": "NoranTec Utilities",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {