geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
878 stars 183 forks source link

Why does my code still have requests released when processing signal.aborted and the catch does not handle this error? #436

Closed xiaxichen closed 2 months ago

xiaxichen commented 2 months ago

`
const abortController = new AbortController();

const { signal } = abortController;
console.log(url, "url");
// 使用 fromUrl 加载 GeoTIFF 文件,并传递 signal
console.log(signal.aborted, "sssssssssss");
console.log("cancel", "sssssssssss");
abortController.abort();
console.log(abortController.signal.aborted, "sssssssssss");
tiff = await fromUrl(url, { signal: signal }).catch((error) => {
console.log(error, "sssssssssss");
if (error.name === "AbortError") {
console.log("GeoTIFF loading was aborted");
}
});
` image

image

constantinius commented 2 months ago

I'm no expert on how already aborted signals are handled in the fetch API. AFAIK, we simply pass the signal along. I'll close this issue now, since I don't believe it is relevant to geotiff.js