surface exceptions to MapLibre protocol API [fixes #196]

This commit is contained in:
Brandon Liu
2023-06-17 09:34:06 +08:00
parent 236e84e24f
commit 2bd776820f

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
.getHeader()
.then((h) => {
const tilejson = { const tilejson = {
tiles: [params.url + "/{z}/{x}/{y}"], tiles: [params.url + "/{z}/{x}/{y}"],
minzoom: h.minZoom, minzoom: h.minZoom,
maxzoom: h.maxZoom, maxzoom: h.maxZoom,
}; };
callback(null, tilejson, null, null); 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);
} }
}); });
}); });