@datapos/datapos-shared 0.3.587 → 0.3.588
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 +20 -19
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class i extends Error {
|
|
2
2
|
data;
|
|
3
3
|
locator;
|
|
4
4
|
// Error locator 'package.module.method'
|
|
@@ -6,45 +6,45 @@ class c extends Error {
|
|
|
6
6
|
super(s, a), this.name = "DPUseError", this.data = r, this.locator = t;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
class u extends
|
|
9
|
+
class u extends i {
|
|
10
10
|
constructor(s, t, r, a) {
|
|
11
11
|
super(s, t, r, a), this.name = "AppError";
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class E extends
|
|
14
|
+
class E extends i {
|
|
15
15
|
constructor(s, t, r, a) {
|
|
16
16
|
super(s, t, r, a), this.name = "APIError";
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
class d extends
|
|
19
|
+
class d extends i {
|
|
20
20
|
constructor(s, t, r, a) {
|
|
21
21
|
super(s, t, r, a), this.name = "EngineError";
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class m extends
|
|
24
|
+
class m extends i {
|
|
25
25
|
constructor(s, t, r, a) {
|
|
26
26
|
super(s, t, r, a), this.name = "ConnectorError";
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
class
|
|
29
|
+
class l extends i {
|
|
30
30
|
constructor(s, t, r, a) {
|
|
31
31
|
super(s, t, r, a), this.name = "FetchError";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
async function p(e, s, t) {
|
|
35
35
|
const r = ` - ${e.statusText}`, a = `${s} Response status '${e.status}${e.statusText ? r : ""}' received.`;
|
|
36
|
-
let
|
|
36
|
+
let c;
|
|
37
37
|
try {
|
|
38
|
-
|
|
39
|
-
} catch (
|
|
40
|
-
|
|
38
|
+
c = await e.text();
|
|
39
|
+
} catch (o) {
|
|
40
|
+
c = `<body unavailable: ${n(o).message}>`;
|
|
41
41
|
}
|
|
42
|
-
return new
|
|
42
|
+
return new l(a, t, { body: f(c) });
|
|
43
43
|
}
|
|
44
44
|
function h(e) {
|
|
45
45
|
return e.map((s) => s.message).join(" ");
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function b(e) {
|
|
48
48
|
try {
|
|
49
49
|
e();
|
|
50
50
|
} catch {
|
|
@@ -63,7 +63,7 @@ function n(e) {
|
|
|
63
63
|
}
|
|
64
64
|
return new Error("Unknown error");
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function w(e) {
|
|
67
67
|
const s = /* @__PURE__ */ new Set(), t = [];
|
|
68
68
|
let r = n(e);
|
|
69
69
|
for (; r != null && !s.has(r); ) {
|
|
@@ -96,7 +96,8 @@ function b(e) {
|
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
default:
|
|
99
|
-
|
|
99
|
+
const c = { ...Object.fromEntries(Object.entries(e ?? {})) };
|
|
100
|
+
r.name ? (a = { data: c, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : n(r.cause)) : (a = { data: c, locator: "", message: g(r), name: "Error", stack: void 0 }, r = null);
|
|
100
101
|
}
|
|
101
102
|
/(?:\.{3}|[.!?])$/.test(a.message) || (a.message += "."), t.push(a);
|
|
102
103
|
}
|
|
@@ -121,7 +122,7 @@ function y(e) {
|
|
|
121
122
|
r = new d(t.message, t.locator, t.data, { cause: s });
|
|
122
123
|
break;
|
|
123
124
|
case "FetchError":
|
|
124
|
-
r = new
|
|
125
|
+
r = new l(t.message, t.locator, t.data, { cause: s });
|
|
125
126
|
break;
|
|
126
127
|
default:
|
|
127
128
|
r = new Error(t.message, { cause: s }), r.name = t.name;
|
|
@@ -148,13 +149,13 @@ export {
|
|
|
148
149
|
E as APIError,
|
|
149
150
|
u as AppError,
|
|
150
151
|
m as ConnectorError,
|
|
151
|
-
|
|
152
|
+
i as DPUseError,
|
|
152
153
|
d as EngineError,
|
|
153
|
-
|
|
154
|
+
l as FetchError,
|
|
154
155
|
p as buildFetchError,
|
|
155
156
|
h as concatenateSerialisedErrorMessages,
|
|
156
|
-
|
|
157
|
+
b as ignoreErrors,
|
|
157
158
|
n as normalizeToError,
|
|
158
|
-
|
|
159
|
+
w as serialiseError,
|
|
159
160
|
y as unserialiseError
|
|
160
161
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.588",
|
|
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>",
|