Merge pull request #199 from protomaps/maplibre-error-reporting

surface exceptions to MapLibre protocol API [fixes #196]
This commit is contained in:
Brandon Liu
2023-06-17 10:41:59 +08:00
committed by GitHub

View File

@@ -123,14 +123,20 @@ export class Protocol {
// TODO: create vector_layers if present to return valid TileJSON
instance.getHeader().then((h) => {
instance
.getHeader()
.then((h) => {
const tilejson = {
tiles: [params.url + "/{z}/{x}/{y}"],
minzoom: h.minZoom,
maxzoom: h.maxZoom,
};
callback(null, tilejson, null, null);
})
.catch((e) => {
callback(e, null, null, null);
});
return {
cancel: () => {},
};
@@ -181,7 +187,7 @@ export class Protocol {
})
.catch((e) => {
if ((e as Error).name !== "AbortError") {
throw e;
callback(e, null, null, null);
}
});
});