Skip to content

Commit

Permalink
Merge pull request #17 from watergis/fix/error-handling-404-sprite
Browse files Browse the repository at this point in the history
fix: add error handling when [email protected] is not reachable
  • Loading branch information
JinIgarashi authored Aug 27, 2023
2 parents dc2062f + 063b40f commit ffc7b41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-steaks-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@watergis/maplibre-gl-legend": patch
---

fix: add error handling when [email protected] is not reachable
8 changes: 5 additions & 3 deletions packages/maplibre-gl-legend/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,11 @@ export class MaplibreLegendControl implements IControl {
this.loadImage(`${styleUrl}@2x.png`),
this.loadJson(`${styleUrl}.json`)
]);
await promise.then(([image, json]) => {
this.setSprite(image, json);
});
await promise
.then(([image, json]) => {
this.setSprite(image, json);
})
.catch((err) => console.error(err));
this.updateLegendControl();
map.off('idle', afterLoadListener);
}
Expand Down

0 comments on commit ffc7b41

Please sign in to comment.