mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
Merge pull request #199 from protomaps/maplibre-error-reporting
surface exceptions to MapLibre protocol API [fixes #196]
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user