@djangocfg/api 1.2.38 → 1.2.40
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 +29 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +29 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/generated/client.ts +38 -0
package/dist/index.cjs
CHANGED
|
@@ -3533,6 +3533,35 @@ var APIClient = class {
|
|
|
3533
3533
|
if (error instanceof APIError) {
|
|
3534
3534
|
throw error;
|
|
3535
3535
|
}
|
|
3536
|
+
const isCORSError = error instanceof TypeError && (error.message.toLowerCase().includes("cors") || error.message.toLowerCase().includes("failed to fetch") || error.message.toLowerCase().includes("network request failed"));
|
|
3537
|
+
if (typeof window !== "undefined") {
|
|
3538
|
+
try {
|
|
3539
|
+
if (isCORSError) {
|
|
3540
|
+
window.dispatchEvent(new CustomEvent("cors-error", {
|
|
3541
|
+
detail: {
|
|
3542
|
+
url,
|
|
3543
|
+
method,
|
|
3544
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3545
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
3546
|
+
},
|
|
3547
|
+
bubbles: true,
|
|
3548
|
+
cancelable: false
|
|
3549
|
+
}));
|
|
3550
|
+
} else {
|
|
3551
|
+
window.dispatchEvent(new CustomEvent("network-error", {
|
|
3552
|
+
detail: {
|
|
3553
|
+
url,
|
|
3554
|
+
method,
|
|
3555
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3556
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
3557
|
+
},
|
|
3558
|
+
bubbles: true,
|
|
3559
|
+
cancelable: false
|
|
3560
|
+
}));
|
|
3561
|
+
}
|
|
3562
|
+
} catch (eventError) {
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3536
3565
|
const networkError = error instanceof Error ? new NetworkError(error.message, url, error) : new NetworkError("Unknown error", url);
|
|
3537
3566
|
if (this.logger) {
|
|
3538
3567
|
this.logger.logError(
|