use error in both reject and destroy

This commit is contained in:
Andrei Kashchikhin
2025-09-24 17:05:25 +02:00
parent 8c6c662cda
commit 7c689a5156
@@ -79,10 +79,9 @@ export async function streamExtractExternal(
return new Promise((resolve, reject) => {
const timerFn = (): void => {
response.message.destroy(
new Error(`Blob storage chunk did not respond in ${timeout}ms`)
)
reject(`Blob storage chunk did not respond in ${timeout}ms`)
const timeoutError = new Error(`Blob storage chunk did not respond in ${timeout}ms`)
response.message.destroy(timeoutError)
reject(timeoutError)
}
const timer = setTimeout(timerFn, timeout)