@datapos/datapos-shared 0.3.589 → 0.3.590
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 +26 -26
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class c extends Error {
|
|
2
2
|
data;
|
|
3
3
|
locator;
|
|
4
4
|
// Error locator 'package.module.method'
|
|
@@ -6,40 +6,40 @@ class i extends Error {
|
|
|
6
6
|
super(s, a), this.name = "DPUseError", this.data = r, this.locator = t;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
class
|
|
9
|
+
class E extends c {
|
|
10
10
|
constructor(s, t, r, a) {
|
|
11
11
|
super(s, t, r, a), this.name = "AppError";
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class d extends c {
|
|
15
15
|
constructor(s, t, r, a) {
|
|
16
16
|
super(s, t, r, a), this.name = "APIError";
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
class
|
|
19
|
+
class m extends c {
|
|
20
20
|
constructor(s, t, r, a) {
|
|
21
21
|
super(s, t, r, a), this.name = "EngineError";
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class g extends c {
|
|
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 u extends c {
|
|
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 i;
|
|
37
37
|
try {
|
|
38
|
-
|
|
39
|
-
} catch (
|
|
40
|
-
|
|
38
|
+
i = await e.text();
|
|
39
|
+
} catch (l) {
|
|
40
|
+
i = `<body unavailable: ${n(l).message}>`;
|
|
41
41
|
}
|
|
42
|
-
return new
|
|
42
|
+
return new u(a, t, { body: k(i) });
|
|
43
43
|
}
|
|
44
44
|
function h(e) {
|
|
45
45
|
return e.map((s) => s.message).join(" ");
|
|
@@ -96,8 +96,8 @@ function w(e) {
|
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
default:
|
|
99
|
-
const
|
|
100
|
-
r.name ? (a = { data:
|
|
99
|
+
const { cause: i, ...l } = Object.fromEntries(Object.entries(r));
|
|
100
|
+
r.name ? (a = { data: l, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : n(r.cause)) : (a = { data: l, locator: "", message: f(r), name: "Error", stack: void 0 }, r = null);
|
|
101
101
|
}
|
|
102
102
|
/(?:\.{3}|[.!?])$/.test(a.message) || (a.message += "."), t.push(a);
|
|
103
103
|
}
|
|
@@ -110,19 +110,19 @@ function y(e) {
|
|
|
110
110
|
let r;
|
|
111
111
|
switch (t.name) {
|
|
112
112
|
case "APIError":
|
|
113
|
-
r = new
|
|
113
|
+
r = new d(t.message, t.locator, t.data, { cause: s });
|
|
114
114
|
break;
|
|
115
115
|
case "AppError":
|
|
116
|
-
r = new
|
|
116
|
+
r = new E(t.message, t.locator, t.data, { cause: s });
|
|
117
117
|
break;
|
|
118
118
|
case "ConnectorError":
|
|
119
|
-
r = new
|
|
119
|
+
r = new g(t.message, t.locator, t.data, { cause: s });
|
|
120
120
|
break;
|
|
121
121
|
case "EngineError":
|
|
122
|
-
r = new
|
|
122
|
+
r = new m(t.message, t.locator, t.data, { cause: s });
|
|
123
123
|
break;
|
|
124
124
|
case "FetchError":
|
|
125
|
-
r = new
|
|
125
|
+
r = new u(t.message, t.locator, t.data, { cause: s });
|
|
126
126
|
break;
|
|
127
127
|
default:
|
|
128
128
|
r = new Error(t.message, { cause: s }), r.name = t.name;
|
|
@@ -132,7 +132,7 @@ function y(e) {
|
|
|
132
132
|
}
|
|
133
133
|
return s;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function f(e) {
|
|
136
136
|
let s;
|
|
137
137
|
try {
|
|
138
138
|
s = JSON.stringify(e);
|
|
@@ -141,17 +141,17 @@ function g(e) {
|
|
|
141
141
|
}
|
|
142
142
|
return s === "" && (s = "Unknown error"), s;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function k(e) {
|
|
145
145
|
if (!(e == null || e === ""))
|
|
146
146
|
return e.length > 2048 ? `${e.slice(0, 2048)}... [truncated]` : e;
|
|
147
147
|
}
|
|
148
148
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
d as APIError,
|
|
150
|
+
E as AppError,
|
|
151
|
+
g as ConnectorError,
|
|
152
|
+
c as DPUseError,
|
|
153
|
+
m as EngineError,
|
|
154
|
+
u as FetchError,
|
|
155
155
|
p as buildFetchError,
|
|
156
156
|
h as concatenateSerialisedErrorMessages,
|
|
157
157
|
b as ignoreErrors,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.590",
|
|
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>",
|