add error handler in tests

This commit is contained in:
Brian Gough 2016-04-06 13:29:19 +01:00
parent 6e18d49736
commit 7a0c2900ab

View file

@ -106,6 +106,7 @@ module.exports = TrackChangesClient =
options.encoding = null options.encoding = null
request.get options, (err, res, body) -> request.get options, (err, res, body) ->
return callback(error) if error? return callback(error) if error?
return callback(new Error("empty response from s3")) if not body?
zlib.gunzip body, (err, result) -> zlib.gunzip body, (err, result) ->
return callback(err) if err? return callback(err) if err?
callback(null, JSON.parse(result.toString())) callback(null, JSON.parse(result.toString()))