Remove various uses of INTERNAL_ERROR

INTERNAL_ERROR now means there really was some internal error
This commit is contained in:
Girish Ramakrishnan
2019-10-24 18:32:33 -07:00
parent 6e57f8cc03
commit ad9097d212
9 changed files with 19 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ function getPublicIp(callback) {
assert.strictEqual(typeof callback, 'function');
superagent.get('http://169.254.169.254/latest/meta-data/public-ipv4').timeout(30 * 1000).end(function (error, result) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error.status ? 'Request failed: ' + error.status : 'Network failure'));
if (error && !error.response) return callback(new BoxError(BoxError.NETWORK_ERROR, error));
if (result.statusCode !== 200) return callback(new BoxError(BoxError.EXTERNAL_ERROR, util.format('%s %j', result.status, result.body)));
callback(null, result.text);