Skip to content

Commit 5e1cd33

Browse files
committed
Add detailed error context (type, provider, URL) for better error messages
1 parent 57cd4be commit 5e1cd33

File tree

7 files changed

+109
-1
lines changed

7 files changed

+109
-1
lines changed

dist/components/index.esm.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ let LayerManager$1 = class LayerManager {
396396
this.onLayerError({
397397
layerId: layerModel.id,
398398
layerName: layerModel.name || layerModel.id,
399+
errorType: 'layer',
400+
errorDescription: 'Failed to load layer data',
401+
provider: layerModel.provider,
402+
url: error.config?.url || null,
399403
error,
400404
timestamp: Date.now()
401405
});
@@ -438,6 +442,20 @@ let LayerManager$1 = class LayerManager {
438442
timestamp: Date.now()
439443
};
440444
console.error(`Error loading bounds for layer ${layerModel.id}:`, error);
445+
446+
// Call error callback if provided (bounds errors are less critical, include context)
447+
if (this.onLayerError) {
448+
this.onLayerError({
449+
layerId: layerModel.id,
450+
layerName: layerModel.name || layerModel.id,
451+
errorType: 'bounds',
452+
errorDescription: 'Failed to load layer boundaries',
453+
provider: layerModel.provider,
454+
url: error.config?.url || null,
455+
error,
456+
timestamp: Date.now()
457+
});
458+
}
441459
});
442460
return this;
443461
}

dist/components/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@
397397
this.onLayerError({
398398
layerId: layerModel.id,
399399
layerName: layerModel.name || layerModel.id,
400+
errorType: 'layer',
401+
errorDescription: 'Failed to load layer data',
402+
provider: layerModel.provider,
403+
url: error.config?.url || null,
400404
error,
401405
timestamp: Date.now()
402406
});
@@ -439,6 +443,20 @@
439443
timestamp: Date.now()
440444
};
441445
console.error(`Error loading bounds for layer ${layerModel.id}:`, error);
446+
447+
// Call error callback if provided (bounds errors are less critical, include context)
448+
if (this.onLayerError) {
449+
this.onLayerError({
450+
layerId: layerModel.id,
451+
layerName: layerModel.name || layerModel.id,
452+
errorType: 'bounds',
453+
errorDescription: 'Failed to load layer boundaries',
454+
provider: layerModel.provider,
455+
url: error.config?.url || null,
456+
error,
457+
timestamp: Date.now()
458+
});
459+
}
442460
});
443461
return this;
444462
}

dist/layer-manager.esm.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ class LayerManager {
367367
this.onLayerError({
368368
layerId: layerModel.id,
369369
layerName: layerModel.name || layerModel.id,
370+
errorType: 'layer',
371+
errorDescription: 'Failed to load layer data',
372+
provider: layerModel.provider,
373+
url: error.config?.url || null,
370374
error,
371375
timestamp: Date.now()
372376
});
@@ -409,6 +413,20 @@ class LayerManager {
409413
timestamp: Date.now()
410414
};
411415
console.error(`Error loading bounds for layer ${layerModel.id}:`, error);
416+
417+
// Call error callback if provided (bounds errors are less critical, include context)
418+
if (this.onLayerError) {
419+
this.onLayerError({
420+
layerId: layerModel.id,
421+
layerName: layerModel.name || layerModel.id,
422+
errorType: 'bounds',
423+
errorDescription: 'Failed to load layer boundaries',
424+
provider: layerModel.provider,
425+
url: error.config?.url || null,
426+
error,
427+
timestamp: Date.now()
428+
});
429+
}
412430
});
413431
return this;
414432
}

dist/layer-manager.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,10 @@
21972197
this.onLayerError({
21982198
layerId: layerModel.id,
21992199
layerName: layerModel.name || layerModel.id,
2200+
errorType: 'layer',
2201+
errorDescription: 'Failed to load layer data',
2202+
provider: layerModel.provider,
2203+
url: error.config?.url || null,
22002204
error,
22012205
timestamp: Date.now()
22022206
});
@@ -2239,6 +2243,20 @@
22392243
timestamp: Date.now()
22402244
};
22412245
console.error(`Error loading bounds for layer ${layerModel.id}:`, error);
2246+
2247+
// Call error callback if provided (bounds errors are less critical, include context)
2248+
if (this.onLayerError) {
2249+
this.onLayerError({
2250+
layerId: layerModel.id,
2251+
layerName: layerModel.name || layerModel.id,
2252+
errorType: 'bounds',
2253+
errorDescription: 'Failed to load layer boundaries',
2254+
provider: layerModel.provider,
2255+
url: error.config?.url || null,
2256+
error,
2257+
timestamp: Date.now()
2258+
});
2259+
}
22422260
});
22432261
return this;
22442262
}

dist/layer-manager.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/layer-manager.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ class LayerManager {
302302
this.onLayerError({
303303
layerId: layerModel.id,
304304
layerName: layerModel.name || layerModel.id,
305+
errorType: 'layer',
306+
errorDescription: 'Failed to load layer data',
307+
provider: layerModel.provider,
308+
url: error.config?.url || null,
305309
error,
306310
timestamp: Date.now()
307311
});
@@ -344,6 +348,20 @@ class LayerManager {
344348
timestamp: Date.now()
345349
};
346350
console.error(`Error loading bounds for layer ${layerModel.id}:`, error);
351+
352+
// Call error callback if provided (bounds errors are less critical, include context)
353+
if (this.onLayerError) {
354+
this.onLayerError({
355+
layerId: layerModel.id,
356+
layerName: layerModel.name || layerModel.id,
357+
errorType: 'bounds',
358+
errorDescription: 'Failed to load layer boundaries',
359+
provider: layerModel.provider,
360+
url: error.config?.url || null,
361+
error,
362+
timestamp: Date.now()
363+
});
364+
}
347365
});
348366
return this;
349367
}

src/layer-manager.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ class LayerManager {
320320
this.onLayerError({
321321
layerId: layerModel.id,
322322
layerName: layerModel.name || layerModel.id,
323+
errorType: 'layer',
324+
errorDescription: 'Failed to load layer data',
325+
provider: layerModel.provider,
326+
url: error.config?.url || null,
323327
error,
324328
timestamp: Date.now()
325329
});
@@ -363,6 +367,20 @@ class LayerManager {
363367
// Mark bounds request as failed to prevent infinite retries
364368
this.failedLayers[promiseHash] = { error, timestamp: Date.now() };
365369
console.error(`Error loading bounds for layer ${layerModel.id}:`, error);
370+
371+
// Call error callback if provided (bounds errors are less critical, include context)
372+
if (this.onLayerError) {
373+
this.onLayerError({
374+
layerId: layerModel.id,
375+
layerName: layerModel.name || layerModel.id,
376+
errorType: 'bounds',
377+
errorDescription: 'Failed to load layer boundaries',
378+
provider: layerModel.provider,
379+
url: error.config?.url || null,
380+
error,
381+
timestamp: Date.now()
382+
});
383+
}
366384
});
367385

368386
return this;

0 commit comments

Comments
 (0)