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