@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.mjs CHANGED
@@ -3196,6 +3196,35 @@ var APIClient = class {
3196
3196
  if (error instanceof APIError) {
3197
3197
  throw error;
3198
3198
  }
3199
+ const isCORSError = error instanceof TypeError && (error.message.toLowerCase().includes("cors") || error.message.toLowerCase().includes("failed to fetch") || error.message.toLowerCase().includes("network request failed"));
3200
+ if (typeof window !== "undefined") {
3201
+ try {
3202
+ if (isCORSError) {
3203
+ window.dispatchEvent(new CustomEvent("cors-error", {
3204
+ detail: {
3205
+ url,
3206
+ method,
3207
+ error: error instanceof Error ? error.message : String(error),
3208
+ timestamp: /* @__PURE__ */ new Date()
3209
+ },
3210
+ bubbles: true,
3211
+ cancelable: false
3212
+ }));
3213
+ } else {
3214
+ window.dispatchEvent(new CustomEvent("network-error", {
3215
+ detail: {
3216
+ url,
3217
+ method,
3218
+ error: error instanceof Error ? error.message : String(error),
3219
+ timestamp: /* @__PURE__ */ new Date()
3220
+ },
3221
+ bubbles: true,
3222
+ cancelable: false
3223
+ }));
3224
+ }
3225
+ } catch (eventError) {
3226
+ }
3227
+ }
3199
3228
  const networkError = error instanceof Error ? new NetworkError(error.message, url, error) : new NetworkError("Unknown error", url);
3200
3229
  if (this.logger) {
3201
3230
  this.logger.logError(