@delopay/sdk 0.17.0 → 0.18.1
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/README.md +14 -6
- package/dist/{chunk-F6HWLDHA.js → chunk-6UL5TW3X.js} +9 -4
- package/dist/chunk-6UL5TW3X.js.map +1 -0
- package/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1 -1
- package/dist/internal.cjs +8 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-F6HWLDHA.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -47,6 +47,7 @@ var DelopayError = class extends Error {
|
|
|
47
47
|
this.type = options.type;
|
|
48
48
|
if (options.requestId !== void 0) this.requestId = options.requestId;
|
|
49
49
|
if (options.rawBody !== void 0) this.rawBody = options.rawBody;
|
|
50
|
+
if (options.data !== void 0) this.data = options.data;
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
var DelopayAuthenticationError = class extends DelopayError {
|
|
@@ -59,7 +60,8 @@ var DelopayAuthenticationError = class extends DelopayError {
|
|
|
59
60
|
code: options?.code || "AUTH_01",
|
|
60
61
|
type: options?.type || "authentication_error",
|
|
61
62
|
requestId: options?.requestId,
|
|
62
|
-
rawBody: options?.rawBody
|
|
63
|
+
rawBody: options?.rawBody,
|
|
64
|
+
data: options?.data
|
|
63
65
|
});
|
|
64
66
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
65
67
|
this.name = "DelopayAuthenticationError";
|
|
@@ -2806,13 +2808,15 @@ var Delopay = class {
|
|
|
2806
2808
|
const message = err.message ?? `Request failed with status ${response.status}`;
|
|
2807
2809
|
const code = err.code ?? "";
|
|
2808
2810
|
const type = err.error_type ?? err.type ?? "";
|
|
2811
|
+
const data = err.data && typeof err.data === "object" && !Array.isArray(err.data) ? err.data : void 0;
|
|
2809
2812
|
const truncatedRaw = truncateRawBody(rawBody);
|
|
2810
2813
|
if (response.status === 401) {
|
|
2811
2814
|
throw new DelopayAuthenticationError(message, {
|
|
2812
2815
|
code,
|
|
2813
2816
|
type,
|
|
2814
2817
|
requestId,
|
|
2815
|
-
rawBody: truncatedRaw
|
|
2818
|
+
rawBody: truncatedRaw,
|
|
2819
|
+
data
|
|
2816
2820
|
});
|
|
2817
2821
|
}
|
|
2818
2822
|
const error = new DelopayError(message, {
|
|
@@ -2820,7 +2824,8 @@ var Delopay = class {
|
|
|
2820
2824
|
code,
|
|
2821
2825
|
type,
|
|
2822
2826
|
requestId,
|
|
2823
|
-
rawBody: truncatedRaw
|
|
2827
|
+
rawBody: truncatedRaw,
|
|
2828
|
+
data
|
|
2824
2829
|
});
|
|
2825
2830
|
const isTransientStatus = response.status >= 500 || response.status === 429;
|
|
2826
2831
|
if (isTransientStatus && isRetryable && attempt < this.maxRetries) {
|