@datapos/datapos-shared 0.3.543 → 0.3.545
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 +34 -32
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
class
|
|
1
|
+
class i extends Error {
|
|
2
2
|
locator;
|
|
3
3
|
/** Logical source of the error. */
|
|
4
4
|
constructor(o, n, e) {
|
|
5
5
|
super(o, e), this.name = new.target.name, this.locator = n;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
class s extends
|
|
8
|
+
class s extends i {
|
|
9
9
|
}
|
|
10
|
-
class
|
|
10
|
+
class f extends s {
|
|
11
11
|
}
|
|
12
12
|
class u extends s {
|
|
13
13
|
}
|
|
@@ -15,10 +15,10 @@ class l extends s {
|
|
|
15
15
|
body;
|
|
16
16
|
/** Sanitized HTTP response body. */
|
|
17
17
|
constructor(o, n, e, t) {
|
|
18
|
-
super(o, n, t), this.name = new.target.name, this.body =
|
|
18
|
+
super(o, n, t), this.name = new.target.name, this.body = E(e ?? void 0);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class
|
|
21
|
+
class m extends i {
|
|
22
22
|
}
|
|
23
23
|
class y extends s {
|
|
24
24
|
componentName;
|
|
@@ -29,9 +29,9 @@ class y extends s {
|
|
|
29
29
|
super(o, n, a), this.name = new.target.name, this.info = e, 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
36
|
async function p(r, o, n) {
|
|
37
37
|
const e = ` - ${r.statusText}`, t = `${o} Response status '${r.status}${r.statusText ? e : ""}' received.`;
|
|
@@ -39,20 +39,20 @@ async function p(r, o, n) {
|
|
|
39
39
|
try {
|
|
40
40
|
a = await r.text();
|
|
41
41
|
} catch (d) {
|
|
42
|
-
a = `<body unavailable: ${
|
|
42
|
+
a = `<body unavailable: ${c(d).message}>`;
|
|
43
43
|
}
|
|
44
44
|
return new l(t, n, a);
|
|
45
45
|
}
|
|
46
46
|
function h(r) {
|
|
47
47
|
return r.map((o) => o.message).join(" ");
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function x(r) {
|
|
50
50
|
try {
|
|
51
51
|
r();
|
|
52
52
|
} catch {
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function c(r) {
|
|
56
56
|
if (r instanceof Error) return r;
|
|
57
57
|
if (typeof r == "string") return new Error(r);
|
|
58
58
|
if (typeof r == "number" || typeof r == "boolean" || typeof r == "bigint") return new Error(String(r));
|
|
@@ -65,20 +65,22 @@ function i(r) {
|
|
|
65
65
|
}
|
|
66
66
|
return new Error("Unknown error");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function R(r) {
|
|
69
69
|
const o = /* @__PURE__ */ new Set(), n = [];
|
|
70
|
-
let e =
|
|
70
|
+
let e = c(r);
|
|
71
71
|
for (; e != null && !o.has(e); ) {
|
|
72
72
|
o.add(e);
|
|
73
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 :
|
|
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 : c(e.cause)) : e instanceof i ? (t = { body: void 0, locator: e.locator, message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : c(e.cause)) : e instanceof Error ? (t = { body: void 0, locator: "", message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : c(e.cause)) : (t = { body: void 0, locator: "", message: g(e), name: "Error", stack: void 0 }, e = null), /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), n.push(t);
|
|
75
75
|
}
|
|
76
76
|
return n;
|
|
77
77
|
}
|
|
78
78
|
function O(r) {
|
|
79
79
|
if (r.length === 0) return;
|
|
80
80
|
let o;
|
|
81
|
+
console.log(1111, r);
|
|
81
82
|
for (const n of r.toReversed()) {
|
|
83
|
+
console.log(2222, n);
|
|
82
84
|
let e;
|
|
83
85
|
if (n.body !== void 0)
|
|
84
86
|
e = new l(n.message, n.locator, n.body, { cause: o });
|
|
@@ -87,7 +89,7 @@ function O(r) {
|
|
|
87
89
|
else
|
|
88
90
|
switch (n.name) {
|
|
89
91
|
case "APIError":
|
|
90
|
-
e = new
|
|
92
|
+
e = new f(n.message, n.locator, { cause: o });
|
|
91
93
|
break;
|
|
92
94
|
case "EngineError":
|
|
93
95
|
e = new u(n.message, n.locator, { cause: o });
|
|
@@ -96,23 +98,23 @@ function O(r) {
|
|
|
96
98
|
e = new s(n.message, n.locator, { cause: o });
|
|
97
99
|
break;
|
|
98
100
|
case "OperationalError":
|
|
99
|
-
e = new
|
|
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
|
+
e = 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
|
-
e = new
|
|
110
|
+
e = new i(n.message, n.locator, { cause: o });
|
|
109
111
|
break;
|
|
110
112
|
}
|
|
111
|
-
n.stack !== void 0 && (e.stack = n.stack), o = e;
|
|
113
|
+
console.log(3333, e), n.stack !== void 0 && (e.stack = n.stack), o = e;
|
|
112
114
|
}
|
|
113
115
|
return o;
|
|
114
116
|
}
|
|
115
|
-
function
|
|
117
|
+
function g(r) {
|
|
116
118
|
let o;
|
|
117
119
|
try {
|
|
118
120
|
o = JSON.stringify(r);
|
|
@@ -121,23 +123,23 @@ function w(r) {
|
|
|
121
123
|
}
|
|
122
124
|
return o === "" && (o = "Unknown error"), o;
|
|
123
125
|
}
|
|
124
|
-
function
|
|
126
|
+
function E(r) {
|
|
125
127
|
if (!(r == null || r === ""))
|
|
126
128
|
return r.length > 2048 ? `${r.slice(0, 2048)}... [truncated]` : r;
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
x as ignoreErrors,
|
|
142
|
+
c as normalizeToError,
|
|
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.545",
|
|
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>",
|