mirror of
https://github.com/actions/cache.git
synced 2024-11-22 01:41:26 +01:00
Merge pull request #300 from actions/aiyan/listen-on-error
error handling for stream
This commit is contained in:
commit
916cc60b3c
3 changed files with 22 additions and 8 deletions
6
dist/restore/index.js
vendored
6
dist/restore/index.js
vendored
|
@ -2379,11 +2379,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);
|
||||
}
|
||||
})));
|
||||
|
|
6
dist/save/index.js
vendored
6
dist/save/index.js
vendored
|
@ -2379,11 +2379,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);
|
||||
}
|
||||
})));
|
||||
|
|
|
@ -295,11 +295,17 @@ async function uploadFile(
|
|||
httpClient,
|
||||
resourceUrl,
|
||||
() =>
|
||||
fs.createReadStream(archivePath, {
|
||||
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…
Reference in a new issue