@datapos/datapos-shared 0.3.349 → 0.3.350
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
class i extends Error {
|
|
2
2
|
locator;
|
|
3
3
|
/** Logical source of the error. */
|
|
4
|
-
constructor(
|
|
5
|
-
super(
|
|
4
|
+
constructor(o, t, r) {
|
|
5
|
+
super(o, r), this.name = new.target.name, this.locator = t;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
class a extends i {
|
|
@@ -14,39 +14,39 @@ class p extends a {
|
|
|
14
14
|
class c extends a {
|
|
15
15
|
body;
|
|
16
16
|
/** Sanitized HTTP response body. */
|
|
17
|
-
constructor(
|
|
18
|
-
super(
|
|
17
|
+
constructor(o, t, r, n) {
|
|
18
|
+
super(o, t, n), this.name = new.target.name, this.body = E(r ?? void 0);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class
|
|
21
|
+
class y extends i {
|
|
22
22
|
}
|
|
23
23
|
class m extends a {
|
|
24
24
|
componentName;
|
|
25
25
|
/** Vue component name, if available. */
|
|
26
26
|
info;
|
|
27
27
|
/** Vue error info string. */
|
|
28
|
-
constructor(
|
|
29
|
-
super(
|
|
28
|
+
constructor(o, t, r, n, s) {
|
|
29
|
+
super(o, t, s), this.name = new.target.name, this.info = r, this.componentName = n;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
class
|
|
32
|
+
class w extends a {
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class b extends a {
|
|
35
35
|
}
|
|
36
|
-
async function
|
|
37
|
-
const r = ` - ${e.statusText}`,
|
|
38
|
-
let
|
|
36
|
+
async function h(e, o, t) {
|
|
37
|
+
const r = ` - ${e.statusText}`, n = `${o} Response status '${e.status}${e.statusText ? r : ""}' received.`;
|
|
38
|
+
let s;
|
|
39
39
|
try {
|
|
40
|
-
|
|
41
|
-
} catch (
|
|
42
|
-
|
|
40
|
+
s = await e.text();
|
|
41
|
+
} catch (d) {
|
|
42
|
+
s = `<body unavailable: ${l(d).message}>`;
|
|
43
43
|
}
|
|
44
|
-
return new c(t, s
|
|
44
|
+
return new c(n, t, s);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return e.map((
|
|
46
|
+
function k(e) {
|
|
47
|
+
return e.map((o) => o.message).join(" ");
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function l(e) {
|
|
50
50
|
if (e instanceof Error) return e;
|
|
51
51
|
if (typeof e == "string") return new Error(e);
|
|
52
52
|
if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint") return new Error(String(e));
|
|
@@ -60,34 +60,42 @@ function f(e) {
|
|
|
60
60
|
return new Error("Unknown error");
|
|
61
61
|
}
|
|
62
62
|
function x(e) {
|
|
63
|
-
const
|
|
63
|
+
const o = /* @__PURE__ */ new Set(), t = [];
|
|
64
64
|
let r = e;
|
|
65
|
-
for (; r != null && !
|
|
66
|
-
|
|
67
|
-
let
|
|
65
|
+
for (; r != null && !o.has(r); ) {
|
|
66
|
+
o.add(r);
|
|
67
|
+
let n;
|
|
68
68
|
if (r instanceof c)
|
|
69
|
-
|
|
69
|
+
n = { componentName: void 0, body: r.body, info: void 0, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
|
|
70
70
|
else if (r instanceof m)
|
|
71
|
-
|
|
71
|
+
n = {
|
|
72
|
+
componentName: r.componentName,
|
|
73
|
+
body: void 0,
|
|
74
|
+
info: r.info,
|
|
75
|
+
locator: r.locator,
|
|
76
|
+
message: r.message,
|
|
77
|
+
name: r.name,
|
|
78
|
+
stack: r.stack
|
|
79
|
+
}, r = r.cause;
|
|
72
80
|
else if (r instanceof i)
|
|
73
|
-
|
|
81
|
+
n = { componentName: void 0, body: void 0, info: void 0, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
|
|
74
82
|
else if (r instanceof Error) {
|
|
75
|
-
const
|
|
76
|
-
|
|
83
|
+
const s = r;
|
|
84
|
+
n = { componentName: void 0, body: void 0, info: void 0, locator: "", message: s.message, name: s.name, stack: s.stack }, r = s.cause;
|
|
77
85
|
} else
|
|
78
|
-
|
|
79
|
-
/(?:\.{3}|[.!?])$/.test(
|
|
86
|
+
n = { componentName: void 0, body: void 0, info: void 0, locator: "", message: f(r), name: "Error", stack: void 0 }, r = void 0;
|
|
87
|
+
/(?:\.{3}|[.!?])$/.test(n.message) || (n.message += "."), t.push(n);
|
|
80
88
|
}
|
|
81
|
-
return
|
|
89
|
+
return t;
|
|
82
90
|
}
|
|
83
|
-
function
|
|
84
|
-
let
|
|
91
|
+
function f(e) {
|
|
92
|
+
let o;
|
|
85
93
|
try {
|
|
86
|
-
|
|
94
|
+
o = JSON.stringify(e);
|
|
87
95
|
} catch {
|
|
88
|
-
typeof e == "symbol" ?
|
|
96
|
+
typeof e == "symbol" ? o = e.description ?? "Unknown error" : typeof e == "bigint" ? o = e.toString() : o = "Unknown error";
|
|
89
97
|
}
|
|
90
|
-
return
|
|
98
|
+
return o === "" && (o = "Unknown error"), o;
|
|
91
99
|
}
|
|
92
100
|
function E(e) {
|
|
93
101
|
if (!(e == null || e === ""))
|
|
@@ -98,12 +106,12 @@ export {
|
|
|
98
106
|
a as ApplicationError,
|
|
99
107
|
p as EngineError,
|
|
100
108
|
c as FetchError,
|
|
101
|
-
|
|
109
|
+
y as OperationalError,
|
|
102
110
|
m as VueHandledError,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
b as WindowHandledPromiseRejectionError,
|
|
112
|
+
w as WindowHandledRuntimeError,
|
|
113
|
+
h as buildFetchError,
|
|
114
|
+
k as concatenateSerialisedErrorMessages,
|
|
115
|
+
l as normalizeToError,
|
|
108
116
|
x as serialiseError
|
|
109
117
|
};
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* Used for logging, reporting, and transport across process or network boundaries.
|
|
6
6
|
*/
|
|
7
7
|
interface SerialisedError {
|
|
8
|
-
/** HTTP response body (Fetch errors only). */ body
|
|
9
|
-
/** Vue component name (Vue errors only). */ componentName
|
|
10
|
-
/** Vue error info string. */ info
|
|
8
|
+
/** HTTP response body (Fetch errors only). */ body: string | undefined;
|
|
9
|
+
/** Vue component name (Vue errors only). */ componentName: string | undefined;
|
|
10
|
+
/** Vue error info string. */ info: string | undefined;
|
|
11
11
|
/** Logical source of the error. */ locator: string;
|
|
12
12
|
/** Human-readable error message. */ message: string;
|
|
13
13
|
/** Error class or type name. */ name: string;
|
|
14
|
-
/** Stack trace, if available. */ stack
|
|
14
|
+
/** Stack trace, if available. */ stack: string | undefined;
|
|
15
15
|
}
|
|
16
16
|
/** Base class for all Data Positioning errors.
|
|
17
17
|
* All errors include a `locator` identifying the logical source of the error (module, feature, or operation).
|
|
@@ -37,7 +37,7 @@ declare class EngineError extends ApplicationError {
|
|
|
37
37
|
* Includes a sanitized snapshot of the response body for diagnostic purposes.
|
|
38
38
|
*/
|
|
39
39
|
declare class FetchError extends ApplicationError {
|
|
40
|
-
readonly body
|
|
40
|
+
readonly body: string | undefined; /** Sanitized HTTP response body. */
|
|
41
41
|
constructor(message: string, locator: string, body?: string | null, options?: ErrorOptions);
|
|
42
42
|
}
|
|
43
43
|
/** Represents operational failures not caused by application logic. */
|
|
@@ -47,7 +47,7 @@ declare class OperationalError extends DataPosError {
|
|
|
47
47
|
* Used when capturing Vue error handler output with additional component context.
|
|
48
48
|
*/
|
|
49
49
|
declare class VueHandledError extends ApplicationError {
|
|
50
|
-
readonly componentName
|
|
50
|
+
readonly componentName: string | undefined; /** Vue component name, if available. */
|
|
51
51
|
readonly info: string; /** Vue error info string. */
|
|
52
52
|
constructor(message: string, locator: string, info: string, componentName?: string, options?: ErrorOptions);
|
|
53
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-shared",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.350",
|
|
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>",
|