@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.
- package/dist/error-util.class.d.ts +3 -0
- package/dist/error-util.class.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -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
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);
|