@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.d.cts
CHANGED
|
@@ -3559,6 +3559,8 @@ declare class DelopayError extends Error {
|
|
|
3559
3559
|
*/
|
|
3560
3560
|
declare class DelopayAuthenticationError extends DelopayError {
|
|
3561
3561
|
constructor(message?: string, options?: {
|
|
3562
|
+
code?: string;
|
|
3563
|
+
type?: string;
|
|
3562
3564
|
requestId?: string;
|
|
3563
3565
|
rawBody?: string;
|
|
3564
3566
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -3559,6 +3559,8 @@ declare class DelopayError extends Error {
|
|
|
3559
3559
|
*/
|
|
3560
3560
|
declare class DelopayAuthenticationError extends DelopayError {
|
|
3561
3561
|
constructor(message?: string, options?: {
|
|
3562
|
+
code?: string;
|
|
3563
|
+
type?: string;
|
|
3562
3564
|
requestId?: string;
|
|
3563
3565
|
rawBody?: string;
|
|
3564
3566
|
});
|
package/dist/index.js
CHANGED
|
@@ -15,8 +15,11 @@ var DelopayAuthenticationError = class extends DelopayError {
|
|
|
15
15
|
constructor(message = "Invalid API key", options) {
|
|
16
16
|
super(message, {
|
|
17
17
|
status: 401,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// Default to the generic "invalid API key" code, but let callers pass
|
|
19
|
+
// through the server-reported code (e.g. `UR_05` for unverified-email
|
|
20
|
+
// 401s) so they can differentiate between auth failure reasons.
|
|
21
|
+
code: options?.code || "AUTH_01",
|
|
22
|
+
type: options?.type || "authentication_error",
|
|
20
23
|
requestId: options?.requestId,
|
|
21
24
|
rawBody: options?.rawBody
|
|
22
25
|
});
|
|
@@ -2964,6 +2967,8 @@ var Delopay = class {
|
|
|
2964
2967
|
const truncatedRaw = truncateRawBody(rawBody);
|
|
2965
2968
|
if (response.status === 401) {
|
|
2966
2969
|
throw new DelopayAuthenticationError(message, {
|
|
2970
|
+
code,
|
|
2971
|
+
type,
|
|
2967
2972
|
requestId,
|
|
2968
2973
|
rawBody: truncatedRaw
|
|
2969
2974
|
});
|