@delopay/sdk 0.5.0 → 0.5.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/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -55,8 +55,11 @@ var DelopayAuthenticationError = class extends DelopayError {
|
|
|
55
55
|
constructor(message = "Invalid API key", options) {
|
|
56
56
|
super(message, {
|
|
57
57
|
status: 401,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// Default to the generic "invalid API key" code, but let callers pass
|
|
59
|
+
// through the server-reported code (e.g. `UR_05` for unverified-email
|
|
60
|
+
// 401s) so they can differentiate between auth failure reasons.
|
|
61
|
+
code: options?.code || "AUTH_01",
|
|
62
|
+
type: options?.type || "authentication_error",
|
|
60
63
|
requestId: options?.requestId,
|
|
61
64
|
rawBody: options?.rawBody
|
|
62
65
|
});
|
|
@@ -3004,6 +3007,8 @@ var Delopay = class {
|
|
|
3004
3007
|
const truncatedRaw = truncateRawBody(rawBody);
|
|
3005
3008
|
if (response.status === 401) {
|
|
3006
3009
|
throw new DelopayAuthenticationError(message, {
|
|
3010
|
+
code,
|
|
3011
|
+
type,
|
|
3007
3012
|
requestId,
|
|
3008
3013
|
rawBody: truncatedRaw
|
|
3009
3014
|
});
|