error handling for stream
This commit is contained in:
parent
da9f90cb83
commit
ee7a57c615
|
@ -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);
|
||||
}
|
||||
})));
|
||||
|
|
|
@ -1434,11 +1434,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);
|
||||
}
|
||||
})));
|
||||
|
|
|
@ -268,11 +268,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 New Issue