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) => { return new Promise((resolve, reject) => {
const timerFn = (): void => { const timerFn = (): void => {
response.message.destroy( const timeoutError = new Error(`Blob storage chunk did not respond in ${timeout}ms`)
new Error(`Blob storage chunk did not respond in ${timeout}ms`) response.message.destroy(timeoutError)
) reject(timeoutError)
reject(`Blob storage chunk did not respond in ${timeout}ms`)
} }
const timer = setTimeout(timerFn, timeout) const timer = setTimeout(timerFn, timeout)