@datapos/datapos-shared 0.3.555 → 0.3.557
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 +36 -36
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
class c extends Error {
|
|
2
2
|
locator;
|
|
3
3
|
/** Logical source of the error. */
|
|
4
|
-
constructor(
|
|
5
|
-
super(
|
|
4
|
+
constructor(s, o, e) {
|
|
5
|
+
super(s, e), this.name = new.target.name, this.locator = o;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
class i extends c {
|
|
@@ -10,31 +10,31 @@ class i extends c {
|
|
|
10
10
|
class g extends i {
|
|
11
11
|
}
|
|
12
12
|
class u extends i {
|
|
13
|
-
constructor(
|
|
14
|
-
super(
|
|
13
|
+
constructor(s, o, e) {
|
|
14
|
+
super(s, o, e), this.name = new.target.name;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
class l extends i {
|
|
18
18
|
body;
|
|
19
19
|
/** Sanitized HTTP response body. */
|
|
20
|
-
constructor(
|
|
21
|
-
super(
|
|
20
|
+
constructor(s, o, e, t) {
|
|
21
|
+
super(s, o, t), this.name = new.target.name, this.body = d(e ?? void 0);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
async function
|
|
25
|
-
const e = ` - ${r.statusText}`, t = `${
|
|
24
|
+
async function k(r, s, o) {
|
|
25
|
+
const e = ` - ${r.statusText}`, t = `${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
30
|
a = `<body unavailable: ${n(f).message}>`;
|
|
31
31
|
}
|
|
32
|
-
return new l(t,
|
|
32
|
+
return new l(t, o, a);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return r.map((
|
|
34
|
+
function y(r) {
|
|
35
|
+
return r.map((s) => s.message).join(" ");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function b(r) {
|
|
38
38
|
try {
|
|
39
39
|
r();
|
|
40
40
|
} catch {
|
|
@@ -54,31 +54,31 @@ function n(r) {
|
|
|
54
54
|
return new Error("Unknown error");
|
|
55
55
|
}
|
|
56
56
|
function w(r) {
|
|
57
|
-
const
|
|
57
|
+
const s = /* @__PURE__ */ new Set(), o = [];
|
|
58
58
|
let e = n(r);
|
|
59
|
-
for (; e != null && !
|
|
60
|
-
|
|
59
|
+
for (; e != null && !s.has(e); ) {
|
|
60
|
+
s.add(e), console.log("CAUSE STACK", e.stack);
|
|
61
61
|
let t;
|
|
62
|
-
e instanceof l ? (t = { body: e.body, locator: e.locator, message: e.message, name: "FetchError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof u ? (t = { body: void 0, locator: e.locator, message: e.message, name: "EngineError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof c ? (t = { body: void 0, locator: e.locator, message: e.message, name: "DataPosError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof Error ? (t = { body: void 0, locator: "", message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : (t = { body: void 0, locator: "", message: E(e), name: "Error", stack: void 0 }, e = null), /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."),
|
|
62
|
+
e instanceof l ? (t = { body: e.body, locator: e.locator, message: e.message, name: "FetchError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof u ? (t = { body: void 0, locator: e.locator, message: e.message, name: "EngineError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof c ? (t = { body: void 0, locator: e.locator, message: e.message, name: "DataPosError", stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : e instanceof Error ? (t = { body: void 0, locator: "", message: e.message, name: e.name, stack: e.stack }, e = e.cause == null ? null : n(e.cause)) : (t = { body: void 0, locator: "", message: E(e), name: "Error", stack: void 0 }, e = null), /(?:\.{3}|[.!?])$/.test(t.message) || (t.message += "."), o.push(t);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return o;
|
|
65
65
|
}
|
|
66
66
|
function h(r) {
|
|
67
67
|
if (r.length === 0) return;
|
|
68
|
-
let
|
|
69
|
-
for (const
|
|
68
|
+
let s;
|
|
69
|
+
for (const o of r.toReversed()) {
|
|
70
70
|
let e;
|
|
71
|
-
if (
|
|
72
|
-
console.log("FetchError"), e = new l(
|
|
73
|
-
else if (
|
|
74
|
-
console.log("Generic"), e = new Error(
|
|
71
|
+
if (o.body !== void 0)
|
|
72
|
+
console.log("FetchError"), e = new l(o.message, o.locator, o.body, { cause: s });
|
|
73
|
+
else if (o.locator === "")
|
|
74
|
+
console.log("Generic"), e = new Error(o.message, { cause: s }), e.name = o.name;
|
|
75
75
|
else
|
|
76
|
-
switch (
|
|
76
|
+
switch (o.name) {
|
|
77
77
|
case "APIError":
|
|
78
|
-
console.log("APIError"), e = new g(
|
|
78
|
+
console.log("APIError"), e = new g(o.message, o.locator, { cause: s });
|
|
79
79
|
break;
|
|
80
80
|
case "EngineError":
|
|
81
|
-
e = new u(
|
|
81
|
+
e = new u(o.message, o.locator, { cause: s }), console.log("EngineError", e);
|
|
82
82
|
break;
|
|
83
83
|
// case 'ApplicationError':
|
|
84
84
|
// error = new ApplicationError(serialised.message, serialised.locator, { rebuiltError });
|
|
@@ -93,21 +93,21 @@ function h(r) {
|
|
|
93
93
|
// error = new WindowHandledPromiseRejectionError(serialised.message, serialised.locator, { rebuiltError });
|
|
94
94
|
// break;
|
|
95
95
|
default:
|
|
96
|
-
console.log("Fallback"), e = new c(
|
|
96
|
+
console.log("Fallback"), e = new c(o.message, o.locator, { cause: s });
|
|
97
97
|
break;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
console.log(1111, e.stack, o.stack), o.stack !== void 0 && (e.stack = o.stack), console.log(2222, e.stack, o.stack), s = e;
|
|
100
100
|
}
|
|
101
|
-
return
|
|
101
|
+
return s;
|
|
102
102
|
}
|
|
103
103
|
function E(r) {
|
|
104
|
-
let
|
|
104
|
+
let s;
|
|
105
105
|
try {
|
|
106
|
-
|
|
106
|
+
s = JSON.stringify(r);
|
|
107
107
|
} catch {
|
|
108
|
-
typeof r == "symbol" ?
|
|
108
|
+
typeof r == "symbol" ? s = r.description ?? "Unknown error" : typeof r == "bigint" ? s = r.toString() : s = "Unknown error";
|
|
109
109
|
}
|
|
110
|
-
return
|
|
110
|
+
return s === "" && (s = "Unknown error"), s;
|
|
111
111
|
}
|
|
112
112
|
function d(r) {
|
|
113
113
|
if (!(r == null || r === ""))
|
|
@@ -117,9 +117,9 @@ export {
|
|
|
117
117
|
g as APIError,
|
|
118
118
|
u as EngineError,
|
|
119
119
|
l as FetchError,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
k as buildFetchError,
|
|
121
|
+
y as concatenateSerialisedErrorMessages,
|
|
122
|
+
b as ignoreErrors,
|
|
123
123
|
n as normalizeToError,
|
|
124
124
|
w as serialiseError,
|
|
125
125
|
h as unserialiseError
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.557",
|
|
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>",
|