@datapos/datapos-shared 0.3.552 → 0.3.553
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
|
@@ -11,36 +11,36 @@ class g extends i {
|
|
|
11
11
|
}
|
|
12
12
|
class u extends i {
|
|
13
13
|
constructor(s, o, e) {
|
|
14
|
-
super(s, o, e), this.name =
|
|
14
|
+
super(s, o, e), this.name = "EngineError";
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
class l extends i {
|
|
18
18
|
body;
|
|
19
19
|
/** Sanitized HTTP response body. */
|
|
20
|
-
constructor(s, o, e,
|
|
21
|
-
super(s, o,
|
|
20
|
+
constructor(s, o, e, n) {
|
|
21
|
+
super(s, o, n), this.name = new.target.name, this.body = d(e ?? void 0);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
async function y(r, s, o) {
|
|
25
|
-
const e = ` - ${r.statusText}`,
|
|
25
|
+
const e = ` - ${r.statusText}`, n = `${s} Response status '${r.status}${r.statusText ? e : ""}' received.`;
|
|
26
26
|
let a;
|
|
27
27
|
try {
|
|
28
28
|
a = await r.text();
|
|
29
29
|
} catch (f) {
|
|
30
|
-
a = `<body unavailable: ${
|
|
30
|
+
a = `<body unavailable: ${t(f).message}>`;
|
|
31
31
|
}
|
|
32
|
-
return new l(
|
|
32
|
+
return new l(n, o, a);
|
|
33
33
|
}
|
|
34
34
|
function b(r) {
|
|
35
35
|
return r.map((s) => s.message).join(" ");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function k(r) {
|
|
38
38
|
try {
|
|
39
39
|
r();
|
|
40
40
|
} catch {
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function t(r) {
|
|
44
44
|
if (r instanceof Error) return r;
|
|
45
45
|
if (typeof r == "string") return new Error(r);
|
|
46
46
|
if (typeof r == "number" || typeof r == "boolean" || typeof r == "bigint") return new Error(String(r));
|
|
@@ -53,13 +53,13 @@ function n(r) {
|
|
|
53
53
|
}
|
|
54
54
|
return new Error("Unknown error");
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function w(r) {
|
|
57
57
|
const s = /* @__PURE__ */ new Set(), o = [];
|
|
58
|
-
let e =
|
|
58
|
+
let e = t(r);
|
|
59
59
|
for (; e != null && !s.has(e); ) {
|
|
60
60
|
s.add(e);
|
|
61
|
-
let
|
|
62
|
-
e instanceof l ? (
|
|
61
|
+
let n;
|
|
62
|
+
e instanceof l ? (n = { body: e.body, locator: e.locator, message: e.message, name: "FetchError", stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : e instanceof u ? (n = { body: void 0, locator: e.locator, message: e.message, name: "EngineError", stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : e instanceof c ? (n = { body: void 0, locator: e.locator, message: e.message, name: "DataPosError", stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : e instanceof Error ? (n = { body: void 0, locator: "", message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : t(e.cause)) : (n = { body: void 0, locator: "", message: E(e), name: "Error", stack: void 0 }, e = null), /(?:\.{3}|[.!?])$/.test(n.message) || (n.message += "."), o.push(n);
|
|
63
63
|
}
|
|
64
64
|
return o;
|
|
65
65
|
}
|
|
@@ -119,8 +119,8 @@ export {
|
|
|
119
119
|
l as FetchError,
|
|
120
120
|
y as buildFetchError,
|
|
121
121
|
b as concatenateSerialisedErrorMessages,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
k as ignoreErrors,
|
|
123
|
+
t as normalizeToError,
|
|
124
|
+
w as serialiseError,
|
|
125
125
|
h as unserialiseError
|
|
126
126
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.553",
|
|
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>",
|