@datapos/datapos-shared 0.3.569 → 0.3.570
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 +10 -13
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ 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 = l(r ?? void 0);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
class E extends c {
|
|
@@ -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 i 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 = l(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 i(t, o, n);
|
|
41
41
|
}
|
|
42
42
|
function b(e) {
|
|
43
43
|
return e.map((s) => s.message).join(" ");
|
|
@@ -90,15 +90,12 @@ function h(e) {
|
|
|
90
90
|
t = { body: void 0, locator: r.locator, message: r.message, name: "DPUError", stack: r.stack }, r = r.cause == null ? null : a(r.cause);
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
93
|
-
case "Error":
|
|
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
|
-
break;
|
|
96
93
|
default:
|
|
97
|
-
|
|
94
|
+
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
95
|
}
|
|
99
96
|
/(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), o.push(t);
|
|
100
97
|
}
|
|
101
|
-
return
|
|
98
|
+
return o;
|
|
102
99
|
}
|
|
103
100
|
function p(e) {
|
|
104
101
|
if (e.length === 0) return;
|
|
@@ -116,13 +113,13 @@ function p(e) {
|
|
|
116
113
|
r = new E(o.message, o.locator, { cause: s });
|
|
117
114
|
break;
|
|
118
115
|
case "FetchError":
|
|
119
|
-
r = new
|
|
116
|
+
r = new i(o.message, o.locator, o.body, { cause: s });
|
|
120
117
|
break;
|
|
121
118
|
case "DPUError":
|
|
122
119
|
r = new c(o.message, o.locator, { cause: s });
|
|
123
120
|
break;
|
|
124
121
|
default:
|
|
125
|
-
|
|
122
|
+
r = new Error(o.message, { cause: s }), r.name = o.name;
|
|
126
123
|
break;
|
|
127
124
|
}
|
|
128
125
|
o.stack !== void 0 && (r.stack = o.stack), s = r;
|
|
@@ -138,7 +135,7 @@ function g(e) {
|
|
|
138
135
|
}
|
|
139
136
|
return s === "" && (s = "Unknown error"), s;
|
|
140
137
|
}
|
|
141
|
-
function
|
|
138
|
+
function l(e) {
|
|
142
139
|
if (!(e == null || e === ""))
|
|
143
140
|
return e.length > 2048 ? `${e.slice(0, 2048)}... [truncated]` : e;
|
|
144
141
|
}
|
|
@@ -147,7 +144,7 @@ export {
|
|
|
147
144
|
m as ConnectorError,
|
|
148
145
|
c as DPUError,
|
|
149
146
|
E as EngineError,
|
|
150
|
-
|
|
147
|
+
i as FetchError,
|
|
151
148
|
y as buildFetchError,
|
|
152
149
|
b as concatenateSerialisedErrorMessages,
|
|
153
150
|
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.570",
|
|
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>",
|