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