mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
js: cleanup error throwing to always use new Error (#504)
This commit is contained in:
@@ -42,7 +42,7 @@ async function nativeDecompress(
|
||||
if (compression === Compression.Gzip) {
|
||||
return zlib.gunzipSync(buf);
|
||||
}
|
||||
throw Error("Compression method not supported");
|
||||
throw new Error("Compression method not supported");
|
||||
}
|
||||
|
||||
// Lambda needs to run with 512MB, empty function takes about 70
|
||||
@@ -90,7 +90,7 @@ class S3Source implements Source {
|
||||
|
||||
const arr = await resp.Body?.transformToByteArray();
|
||||
|
||||
if (!arr) throw Error("Failed to read S3 response body");
|
||||
if (!arr) throw new Error("Failed to read S3 response body");
|
||||
|
||||
return {
|
||||
data: arr.buffer,
|
||||
|
||||
@@ -36,7 +36,7 @@ async function nativeDecompress(
|
||||
const result = stream?.pipeThrough(new DecompressionStream("gzip"));
|
||||
return new Response(result).arrayBuffer();
|
||||
}
|
||||
throw Error("Compression method not supported");
|
||||
throw new Error("Compression method not supported");
|
||||
}
|
||||
|
||||
const CACHE = new ResolvedValueCache(25, undefined, nativeDecompress);
|
||||
|
||||
Reference in New Issue
Block a user