diff --git a/services/web/app/src/Features/History/HistoryController.js b/services/web/app/src/Features/History/HistoryController.js index 00f97e33d8..1319f6b088 100644 --- a/services/web/app/src/Features/History/HistoryController.js +++ b/services/web/app/src/Features/History/HistoryController.js @@ -352,10 +352,31 @@ module.exports = HistoryController = { }) return next(err) } + if (response.statusCode !== 200) { + if (response.statusCode === 404) { + return next(new Errors.NotFoundError('zip not found')) + } else { + return next( + new OError('Error while getting zip for download', { + v1ProjectId, + statusCode: response.statusCode, + }) + ) + } + } if (req.aborted) { // client has disconnected -- skip delayed s3 download return } + if (!body.zipUrl) { + return next( + new OError('Missing zipUrl, cannot fetch zip file', { + v1ProjectId, + body, + statusCode: response.statusCode, + }) + ) + } let retryAttempt = 0 let retryDelay = 2000 // retry for about 6 minutes starting with short delay