fix: stream errors not being handled

This commit is contained in:
Adhiraj Singh
2023-03-03 12:28:16 +05:30
parent d25bd4542d
commit 7e9b9b7f9a

View File

@@ -371,13 +371,18 @@ export const encryptedStream = async(
didSaveToTmpPath didSaveToTmpPath
} }
} catch(error) { } catch(error) {
encWriteStream.destroy(error) try {
writeStream?.destroy(error) // destroy all streams with error
aes.destroy(error) encWriteStream.destroy(error)
hmac.destroy(error) writeStream?.destroy(error)
sha256Plain.destroy(error) aes.destroy(error)
sha256Enc.destroy(error) hmac.destroy(error)
stream.destroy(error) sha256Plain.destroy(error)
sha256Enc.destroy(error)
stream.destroy(error)
} catch{
// swallow error
}
if(didSaveToTmpPath) { if(didSaveToTmpPath) {
try { try {