Skip to content

Commit

Permalink
Merge pull request #1135 from Deltares/suppress-abort-errors-maplibre
Browse files Browse the repository at this point in the history
Suppress maplibre abort errors since they trigger on normal behaviour
  • Loading branch information
ceesvoesenek authored Dec 18, 2024
2 parents fec0f45 + 5821f51 commit 1625aca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/wms/AnimatedRasterLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,25 @@ function onEndLoading(e: MapSourceDataEvent): void {
isLoading.value = false
}
function onError(e: ErrorEvent) {
// NOTE: All maplibre errors are printed to the console
// if no error event listener is added. Abort errors
// happen mostly when the user moves the map before
// the image is loaded. This is almost never an error.
if (e.error.name === 'AbortError') {
return
}
console.error(e)
}
function addHooksToMapObject() {
map?.on('load', onLayerChange)
map?.on('moveend', onMapMove)
map?.on('sourcedata', onDataChange)
map?.on('dblclick', onDoubleClick)
map?.on('dataloading', onStartLoading)
map?.on('sourcedata', onEndLoading)
map?.on('error', onError)
}
function removeHooksFromMapObject(): void {
Expand All @@ -105,6 +117,7 @@ function removeHooksFromMapObject(): void {
map?.off('dblclick', onDoubleClick)
map?.off('dataloading', onStartLoading)
map?.off('sourcedata', onEndLoading)
map?.off('error', onError)
}
function getImageSourceOptions(): any {
Expand Down

0 comments on commit 1625aca

Please sign in to comment.