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