Skip to content

Commit

Permalink
Add handling for no error callback
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanwins committed May 9, 2022
1 parent a08e9ba commit 81b47d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ async function addOverviewAssetForFeature (feature, layerGroup, crossOrigin, err
if (isImageType(asset.type)) {
const lyr = await imageOverlay(asset.href, [[feature.bbox[1], feature.bbox[0]], [feature.bbox[3], feature.bbox[2]]], crossOrigin);
if (lyr === null) {
errorCallback()
if (errorCallback) errorCallback()
return
}
layerGroup.addLayer(lyr)
lyr.on('error', () => {
layerGroup.removeLayer(lyr)
errorCallback()
if (errorCallback) errorCallback()
})
}
}
Expand All @@ -98,13 +98,13 @@ async function addThumbnailAssetForFeature (feature, layerGroup, crossOrigin, er
if (isImageType(asset.type)) {
const lyr = await imageOverlay(asset.href, [[feature.bbox[1], feature.bbox[0]], [feature.bbox[3], feature.bbox[2]]], crossOrigin);
if (lyr === null) {
errorCallback()
if (errorCallback) errorCallback()
return
}
layerGroup.addLayer(lyr)
lyr.on('error', () => {
layerGroup.removeLayer(lyr)
errorCallback()
if (errorCallback) errorCallback()
})
}
}
Expand Down

0 comments on commit 81b47d8

Please sign in to comment.