@datapos/datapos-shared 0.3.567 → 0.3.569
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 +15 -15
- package/package.json +1 -1
|
@@ -5,14 +5,14 @@ class c extends Error {
|
|
|
5
5
|
super(s, r), this.name = "DPUError", this.locator = o;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
class
|
|
8
|
+
class d extends c {
|
|
9
9
|
body;
|
|
10
10
|
// Sanitized snapshot of the response body
|
|
11
11
|
constructor(s, o, r, t) {
|
|
12
|
-
super(s, o, t), this.name = "APIError", this.body =
|
|
12
|
+
super(s, o, t), this.name = "APIError", this.body = i(r ?? void 0);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
class
|
|
15
|
+
class E extends c {
|
|
16
16
|
constructor(s, o, r) {
|
|
17
17
|
super(s, o, r), this.name = "EngineError";
|
|
18
18
|
}
|
|
@@ -22,11 +22,11 @@ class m extends c {
|
|
|
22
22
|
super(s, o, r), this.name = "ConnectorError";
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
class
|
|
25
|
+
class l extends c {
|
|
26
26
|
body;
|
|
27
27
|
// Sanitized snapshot of the response body
|
|
28
28
|
constructor(s, o, r, t) {
|
|
29
|
-
super(s, o, t), this.name = "FetchError", this.body =
|
|
29
|
+
super(s, o, t), this.name = "FetchError", this.body = i(r ?? void 0);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
async function y(e, s, o) {
|
|
@@ -37,7 +37,7 @@ async function y(e, s, o) {
|
|
|
37
37
|
} catch (u) {
|
|
38
38
|
n = `<body unavailable: ${a(u).message}>`;
|
|
39
39
|
}
|
|
40
|
-
return new
|
|
40
|
+
return new l(t, o, n);
|
|
41
41
|
}
|
|
42
42
|
function b(e) {
|
|
43
43
|
return e.map((s) => s.message).join(" ");
|
|
@@ -91,10 +91,10 @@ function h(e) {
|
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
93
93
|
case "Error":
|
|
94
|
-
t = { body: void 0, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : a(r.cause);
|
|
94
|
+
console.log(7777, r), t = { body: void 0, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : a(r.cause);
|
|
95
95
|
break;
|
|
96
96
|
default:
|
|
97
|
-
t = { body: void 0, locator: "", message: g(r), name: "Error", stack: void 0 }, r = null;
|
|
97
|
+
console.log(8888, r), r.name ? (t = { body: void 0, locator: "", message: r.message, name: r.name, stack: r.stack }, r = r.cause == null ? null : a(r.cause)) : (t = { body: void 0, locator: "", message: g(r), name: "Error", stack: void 0 }, r = null);
|
|
98
98
|
}
|
|
99
99
|
/(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), o.push(t);
|
|
100
100
|
}
|
|
@@ -107,16 +107,16 @@ function p(e) {
|
|
|
107
107
|
let r;
|
|
108
108
|
switch (o.name) {
|
|
109
109
|
case "APIError":
|
|
110
|
-
r = new
|
|
110
|
+
r = new d(o.message, o.locator, o.body, { cause: s });
|
|
111
111
|
break;
|
|
112
112
|
case "ConnectorError":
|
|
113
113
|
r = new m(o.message, o.locator, { cause: s });
|
|
114
114
|
break;
|
|
115
115
|
case "EngineError":
|
|
116
|
-
r = new
|
|
116
|
+
r = new E(o.message, o.locator, { cause: s });
|
|
117
117
|
break;
|
|
118
118
|
case "FetchError":
|
|
119
|
-
r = new
|
|
119
|
+
r = new l(o.message, o.locator, o.body, { cause: s });
|
|
120
120
|
break;
|
|
121
121
|
case "DPUError":
|
|
122
122
|
r = new c(o.message, o.locator, { cause: s });
|
|
@@ -138,16 +138,16 @@ function g(e) {
|
|
|
138
138
|
}
|
|
139
139
|
return s === "" && (s = "Unknown error"), s;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function i(e) {
|
|
142
142
|
if (!(e == null || e === ""))
|
|
143
143
|
return e.length > 2048 ? `${e.slice(0, 2048)}... [truncated]` : e;
|
|
144
144
|
}
|
|
145
145
|
export {
|
|
146
|
-
|
|
146
|
+
d as APIError,
|
|
147
147
|
m as ConnectorError,
|
|
148
148
|
c as DPUError,
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
E as EngineError,
|
|
150
|
+
l as FetchError,
|
|
151
151
|
y as buildFetchError,
|
|
152
152
|
b as concatenateSerialisedErrorMessages,
|
|
153
153
|
k 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.569",
|
|
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>",
|