3
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-22 11:25:31 +00:00

error handling for stream

This commit is contained in:
Aiqiao Yan 2020-05-08 14:27:52 -04:00
parent 5ddc028cc8
commit 4967c8e6c5
3 changed files with 22 additions and 8 deletions

View file

@ -295,12 +295,18 @@ async function uploadFile(
httpClient,
resourceUrl,
() =>
fs.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
}),
fs
.createReadStream(archivePath, {
fd,
start,
end,
autoClose: false
})
.on("error", error => {
throw new Error(
`Cache upload failed because file read failed with ${error.Message}`
);
}),
start,
end
);