mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-22 16:53:57 +08:00
error handling for stream
This commit is contained in:
parent
da9f90cb83
commit
ee7a57c615
3 changed files with 22 additions and 8 deletions
6
dist/restore/index.js
vendored
6
dist/restore/index.js
vendored
|
@ -1435,11 +1435,15 @@ function uploadFile(httpClient, cacheId, archivePath) {
|
|||
const start = offset;
|
||||
const end = offset + chunkSize - 1;
|
||||
offset += MAX_CHUNK_SIZE;
|
||||
yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, {
|
||||
yield uploadChunk(httpClient, resourceUrl, () => 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);
|
||||
}
|
||||
})));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue