@datapos/datapos-shared 0.3.534 → 0.3.535
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.
|
@@ -53,19 +53,17 @@ function y(r) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function i(r) {
|
|
56
|
-
if (r
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return new Error("Unknown error");
|
|
68
|
-
}
|
|
56
|
+
if (r instanceof Error) return r;
|
|
57
|
+
if (typeof r == "string") return new Error(r);
|
|
58
|
+
if (typeof r == "number" || typeof r == "boolean" || typeof r == "bigint") return new Error(String(r));
|
|
59
|
+
if (typeof r == "symbol") return new Error(r.description ?? "Unknown error");
|
|
60
|
+
if (typeof r == "object")
|
|
61
|
+
try {
|
|
62
|
+
return new Error(JSON.stringify(r));
|
|
63
|
+
} catch {
|
|
64
|
+
return new Error("Unknown error");
|
|
65
|
+
}
|
|
66
|
+
return new Error("Unknown error");
|
|
69
67
|
}
|
|
70
68
|
function R(r) {
|
|
71
69
|
const n = /* @__PURE__ */ new Set(), o = [];
|
|
@@ -72,7 +72,7 @@ declare function ignoreErrors(action: () => void): void;
|
|
|
72
72
|
/** Normalizes an unknown thrown value into an {@link Error}.
|
|
73
73
|
* This function should be used at error boundaries to guarantee consistent error handling.
|
|
74
74
|
*/
|
|
75
|
-
declare function normalizeToError(value
|
|
75
|
+
declare function normalizeToError(value: unknown): Error;
|
|
76
76
|
/** Serializes an error and its cause chain into a flat structure.
|
|
77
77
|
* - Errors are ordered from outermost to root cause.
|
|
78
78
|
* - Cycles in the cause chain are safely ignored.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.535",
|
|
4
4
|
"description": "A library containing common constants, types and utilities used across all Data Positioning projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jonathan Terrell <terrell.jm@gmail.com>",
|