@datapos/datapos-shared 0.3.554 → 0.3.556

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.
@@ -11,25 +11,25 @@ class g extends i {
11
11
  }
12
12
  class u extends i {
13
13
  constructor(o, s, e) {
14
- super(o, s, e), this.name = "EngineError";
14
+ super(o, s, 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(o, s, e, n) {
21
- super(o, s, n), this.name = new.target.name, this.body = d(e ?? void 0);
20
+ constructor(o, s, e, t) {
21
+ super(o, s, t), this.name = new.target.name, this.body = d(e ?? void 0);
22
22
  }
23
23
  }
24
24
  async function y(r, o, s) {
25
- const e = ` - ${r.statusText}`, n = `${o} Response status '${r.status}${r.statusText ? e : ""}' received.`;
25
+ const e = ` - ${r.statusText}`, t = `${o} 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: ${t(f).message}>`;
30
+ a = `<body unavailable: ${n(f).message}>`;
31
31
  }
32
- return new l(n, s, a);
32
+ return new l(t, s, a);
33
33
  }
34
34
  function b(r) {
35
35
  return r.map((o) => o.message).join(" ");
@@ -40,7 +40,7 @@ function k(r) {
40
40
  } catch {
41
41
  }
42
42
  }
43
- function t(r) {
43
+ function n(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));
@@ -55,11 +55,11 @@ function t(r) {
55
55
  }
56
56
  function w(r) {
57
57
  const o = /* @__PURE__ */ new Set(), s = [];
58
- let e = t(r);
58
+ let e = n(r);
59
59
  for (; e != null && !o.has(e); ) {
60
- o.add(e);
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 += "."), s.push(n);
60
+ o.add(e), console.log("CAUSE STACK", e.stack);
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 += "."), s.push(t);
63
63
  }
64
64
  return s;
65
65
  }
@@ -120,7 +120,7 @@ export {
120
120
  y as buildFetchError,
121
121
  b as concatenateSerialisedErrorMessages,
122
122
  k as ignoreErrors,
123
- t as normalizeToError,
123
+ n as normalizeToError,
124
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.554",
3
+ "version": "0.3.556",
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>",