Handle non-successful responses from uploadChunk

This commit is contained in:
Dave Hadka committed 2020-11-03 09:53:44 -06:00
1 parent 9db07a8e39
commit 4edfa28553
1 file changed
+7 -1
+7 -1
View File
@@ -194,7 +194,7 @@ async function uploadChunk(
'Content-Range': getContentRange(start, end) 'Content-Range': getContentRange(start, end)
} }
await retryHttpClientResponse( const uploadChunkResponse = await retryHttpClientResponse(
`uploadChunk (start: ${start}, end: ${end})`, `uploadChunk (start: ${start}, end: ${end})`,
async () => async () =>
httpClient.sendStream( httpClient.sendStream(
@@ -204,6 +204,12 @@ async function uploadChunk(
additionalHeaders additionalHeaders
) )
) )
if (!isSuccessStatusCode(uploadChunkResponse.message.statusCode)) {
throw new Error(
`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`
)
}
} }
async function uploadFile( async function uploadFile(