1
0
Fork 0

Handle non-successful responses from uploadChunk

pull/624/head
Dave Hadka 2020-11-03 09:53:44 -06:00
parent f1b118b2a9
commit 678f278caa
1 changed files with 7 additions and 1 deletions

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(