@cords/sdk 0.1.1 → 0.1.3
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.js +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -69,10 +69,11 @@ var CordsAPI = ({
|
|
|
69
69
|
}, referer ? { referer } : {}), init == null ? void 0 : init.headers)
|
|
70
70
|
}));
|
|
71
71
|
if (!res.ok) {
|
|
72
|
-
if (res.status
|
|
72
|
+
if ([401, 403].includes(res.status)) {
|
|
73
73
|
throw new Error(
|
|
74
74
|
"Bad API key. Ensure you have a valid API key."
|
|
75
75
|
);
|
|
76
|
+
}
|
|
76
77
|
const data = await res.json();
|
|
77
78
|
if (data.detail) throw new Error(data.detail);
|
|
78
79
|
else throw new Error("An error occurred");
|
package/dist/index.mjs
CHANGED
|
@@ -46,10 +46,11 @@ var CordsAPI = ({
|
|
|
46
46
|
}, referer ? { referer } : {}), init == null ? void 0 : init.headers)
|
|
47
47
|
}));
|
|
48
48
|
if (!res.ok) {
|
|
49
|
-
if (res.status
|
|
49
|
+
if ([401, 403].includes(res.status)) {
|
|
50
50
|
throw new Error(
|
|
51
51
|
"Bad API key. Ensure you have a valid API key."
|
|
52
52
|
);
|
|
53
|
+
}
|
|
53
54
|
const data = await res.json();
|
|
54
55
|
if (data.detail) throw new Error(data.detail);
|
|
55
56
|
else throw new Error("An error occurred");
|