diff --git a/dist/restore/index.js b/dist/restore/index.js index d2b9af7..6d88c89 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -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); } }))); diff --git a/dist/save/index.js b/dist/save/index.js index acb0391..e91ab93 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -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); } }))); diff --git a/src/cacheHttpClient.ts b/src/cacheHttpClient.ts index 1b34a58..cecdaae 100644 --- a/src/cacheHttpClient.ts +++ b/src/cacheHttpClient.ts @@ -268,12 +268,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 );