@datapos/datapos-shared 0.3.530 → 0.3.531
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.
|
@@ -1,80 +1,82 @@
|
|
|
1
|
-
class
|
|
1
|
+
class c extends Error {
|
|
2
2
|
locator;
|
|
3
3
|
/** Logical source of the error. */
|
|
4
4
|
constructor(n, o, e) {
|
|
5
5
|
super(n, e), this.name = new.target.name, this.locator = o;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
class a extends
|
|
9
|
-
}
|
|
10
|
-
class d extends a {
|
|
8
|
+
class a extends c {
|
|
11
9
|
}
|
|
12
10
|
class f extends a {
|
|
13
11
|
}
|
|
14
|
-
class
|
|
12
|
+
class u extends a {
|
|
13
|
+
}
|
|
14
|
+
class m extends a {
|
|
15
15
|
body;
|
|
16
16
|
/** Sanitized HTTP response body. */
|
|
17
|
-
constructor(n, o, e,
|
|
18
|
-
super(n, o,
|
|
17
|
+
constructor(n, o, e, s) {
|
|
18
|
+
super(n, o, s), this.name = new.target.name, this.body = p(e ?? void 0);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class
|
|
21
|
+
class E extends c {
|
|
22
22
|
}
|
|
23
|
-
class
|
|
23
|
+
class d extends a {
|
|
24
24
|
componentName;
|
|
25
25
|
/** Vue component name, if available. */
|
|
26
26
|
info;
|
|
27
27
|
/** Vue error info string. */
|
|
28
|
-
constructor(n, o, e,
|
|
29
|
-
super(n, o,
|
|
28
|
+
constructor(n, o, e, s, t) {
|
|
29
|
+
super(n, o, t), this.name = new.target.name, this.info = e, this.componentName = s;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
class
|
|
32
|
+
class g extends a {
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class w extends a {
|
|
35
35
|
}
|
|
36
|
-
async function
|
|
37
|
-
const e = ` - ${r.statusText}`,
|
|
38
|
-
let
|
|
36
|
+
async function k(r, n, o) {
|
|
37
|
+
const e = ` - ${r.statusText}`, s = `${n} Response status '${r.status}${r.statusText ? e : ""}' received.`;
|
|
38
|
+
let t;
|
|
39
39
|
try {
|
|
40
|
-
|
|
41
|
-
} catch (
|
|
42
|
-
|
|
40
|
+
t = await r.text();
|
|
41
|
+
} catch (l) {
|
|
42
|
+
t = `<body unavailable: ${i(l).message}>`;
|
|
43
43
|
}
|
|
44
|
-
return new
|
|
44
|
+
return new m(s, o, t);
|
|
45
45
|
}
|
|
46
46
|
function h(r) {
|
|
47
47
|
return r.map((n) => n.message).join(" ");
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function y(r) {
|
|
50
50
|
try {
|
|
51
51
|
r();
|
|
52
52
|
} catch {
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
if (r
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
function i(r) {
|
|
56
|
+
if (r != null) {
|
|
57
|
+
if (r instanceof Error) return r;
|
|
58
|
+
if (typeof r == "string") return new Error(r);
|
|
59
|
+
if (typeof r == "number" || typeof r == "boolean" || typeof r == "bigint") return new Error(String(r));
|
|
60
|
+
if (typeof r == "symbol") return new Error(r.description ?? "Unknown error");
|
|
61
|
+
if (typeof r == "object")
|
|
62
|
+
try {
|
|
63
|
+
return new Error(JSON.stringify(r));
|
|
64
|
+
} catch {
|
|
65
|
+
return new Error("Unknown error");
|
|
66
|
+
}
|
|
67
|
+
return new Error("Unknown error");
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
|
-
function
|
|
70
|
+
function R(r) {
|
|
69
71
|
const n = /* @__PURE__ */ new Set(), o = [];
|
|
70
|
-
let e = r;
|
|
72
|
+
let e = i(r);
|
|
71
73
|
for (; e != null && !n.has(e); ) {
|
|
72
74
|
n.add(e);
|
|
73
|
-
let
|
|
74
|
-
if (e instanceof
|
|
75
|
-
|
|
76
|
-
else if (e instanceof
|
|
77
|
-
|
|
75
|
+
let s;
|
|
76
|
+
if (e instanceof m)
|
|
77
|
+
s = { componentName: void 0, body: e.body, info: void 0, locator: e.locator, message: e.message, name: e.name, stack: e.stack }, e = i(e.cause);
|
|
78
|
+
else if (e instanceof d)
|
|
79
|
+
s = {
|
|
78
80
|
componentName: e.componentName,
|
|
79
81
|
body: void 0,
|
|
80
82
|
info: e.info,
|
|
@@ -82,51 +84,50 @@ function x(r) {
|
|
|
82
84
|
message: e.message,
|
|
83
85
|
name: e.name,
|
|
84
86
|
stack: e.stack
|
|
85
|
-
}, e = e.cause;
|
|
86
|
-
else if (e instanceof
|
|
87
|
-
|
|
88
|
-
else
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), o.push(t);
|
|
87
|
+
}, e = i(e.cause);
|
|
88
|
+
else if (e instanceof c)
|
|
89
|
+
s = { componentName: void 0, body: void 0, info: void 0, locator: e.locator, message: e.message, name: e.name, stack: e.stack }, e = i(e.cause);
|
|
90
|
+
else {
|
|
91
|
+
const t = e;
|
|
92
|
+
s = { componentName: void 0, body: void 0, info: void 0, locator: "", message: t.message, name: t.name, stack: t.stack }, e = i(e.cause);
|
|
93
|
+
}
|
|
94
|
+
/(?:\.{3}|[.!?])$/.test(s.message) || (s.message += "."), o.push(s);
|
|
94
95
|
}
|
|
95
96
|
return o;
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function x(r) {
|
|
98
99
|
if (r.length === 0) return;
|
|
99
100
|
let n;
|
|
100
101
|
for (const o of r.toReversed()) {
|
|
101
102
|
let e;
|
|
102
103
|
if (o.body !== void 0)
|
|
103
|
-
e = new
|
|
104
|
+
e = new m(o.message, o.locator, o.body, { cause: n });
|
|
104
105
|
else if (o.info !== void 0)
|
|
105
|
-
e = new
|
|
106
|
+
e = new d(o.message, o.locator, o.info, o.componentName, { cause: n });
|
|
106
107
|
else if (o.locator === "")
|
|
107
108
|
e = new Error(o.message, { cause: n }), e.name = o.name;
|
|
108
109
|
else
|
|
109
110
|
switch (o.name) {
|
|
110
111
|
case "APIError":
|
|
111
|
-
e = new
|
|
112
|
+
e = new f(o.message, o.locator, { cause: n });
|
|
112
113
|
break;
|
|
113
114
|
case "EngineError":
|
|
114
|
-
e = new
|
|
115
|
+
e = new u(o.message, o.locator, { cause: n });
|
|
115
116
|
break;
|
|
116
117
|
case "ApplicationError":
|
|
117
118
|
e = new a(o.message, o.locator, { cause: n });
|
|
118
119
|
break;
|
|
119
120
|
case "OperationalError":
|
|
120
|
-
e = new
|
|
121
|
+
e = new E(o.message, o.locator, { cause: n });
|
|
121
122
|
break;
|
|
122
123
|
case "WindowHandledRuntimeError":
|
|
123
|
-
e = new
|
|
124
|
+
e = new g(o.message, o.locator, { cause: n });
|
|
124
125
|
break;
|
|
125
126
|
case "WindowHandledPromiseRejectionError":
|
|
126
|
-
e = new
|
|
127
|
+
e = new w(o.message, o.locator, { cause: n });
|
|
127
128
|
break;
|
|
128
129
|
default:
|
|
129
|
-
e = new
|
|
130
|
+
e = new c(o.message, o.locator, { cause: n });
|
|
130
131
|
break;
|
|
131
132
|
}
|
|
132
133
|
o.stack !== void 0 && (e.stack = o.stack), n = e;
|
|
@@ -134,31 +135,22 @@ function v(r) {
|
|
|
134
135
|
return n;
|
|
135
136
|
}
|
|
136
137
|
function p(r) {
|
|
137
|
-
let n;
|
|
138
|
-
try {
|
|
139
|
-
n = JSON.stringify(r);
|
|
140
|
-
} catch {
|
|
141
|
-
typeof r == "symbol" ? n = r.description ?? "Unknown error" : typeof r == "bigint" ? n = r.toString() : n = "Unknown error";
|
|
142
|
-
}
|
|
143
|
-
return n === "" && (n = "Unknown error"), n;
|
|
144
|
-
}
|
|
145
|
-
function b(r) {
|
|
146
138
|
if (!(r == null || r === ""))
|
|
147
139
|
return r.length > 2048 ? `${r.slice(0, 2048)}... [truncated]` : r;
|
|
148
140
|
}
|
|
149
141
|
export {
|
|
150
|
-
|
|
142
|
+
f as APIError,
|
|
151
143
|
a as ApplicationError,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
144
|
+
u as EngineError,
|
|
145
|
+
m as FetchError,
|
|
146
|
+
E as OperationalError,
|
|
147
|
+
d as VueHandledError,
|
|
148
|
+
w as WindowHandledPromiseRejectionError,
|
|
149
|
+
g as WindowHandledRuntimeError,
|
|
150
|
+
k as buildFetchError,
|
|
159
151
|
h as concatenateSerialisedErrorMessages,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
152
|
+
y as ignoreErrors,
|
|
153
|
+
i as normalizeToError,
|
|
154
|
+
R as serialiseError,
|
|
155
|
+
x as unserialiseError
|
|
164
156
|
};
|
|
@@ -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 | undefined;
|
|
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.531",
|
|
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>",
|