Check error in webhdfs.sendRequest before trying to check response code. (#4561)

This commit is contained in:
Cory Rivera
2019-03-15 16:52:08 -07:00
committed by GitHub
parent c4e8aba1c9
commit c9ac49c758

View File

@@ -213,11 +213,12 @@ export class WebHDFS {
request(requestParams, (error, response, body) => {
if (!callback) { return; }
if (this.isSuccess(response)) {
callback(undefined, response);
} else if (error || this.isError(response)) {
if (error || this.isError(response)) {
let hdfsError = this.parseError(response, body, error);
callback(hdfsError, response);
} else if (this.isSuccess(response)) {
callback(undefined, response);
} else {
let hdfsError = new HdfsError(
localize('webhdfs.unexpectedRedirect', 'Unexpected Redirect'),