Skip to content

Commit

Permalink
better error parsing for open
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnoble committed Apr 12, 2017
1 parent fe59f51 commit bbdbb89
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/webhdfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ WebHDFSClient.prototype.open = function (path, hdfsoptions, requestoptions, call

// format request args
var args = _.defaults({
json: true,
uri: this.base_url + path,
qs: _.defaults({
op: 'open'
Expand All @@ -330,7 +331,10 @@ WebHDFSClient.prototype.open = function (path, hdfsoptions, requestoptions, call

// forward request error
if (error) return callback(error);


if (typeof body === 'object' && 'RemoteException' in body){
return callback(new RemoteException(body));
}
// execute callback
return callback(null, body);

Expand Down

0 comments on commit bbdbb89

Please sign in to comment.