Skip to content

Commit

Permalink
do not attempt to deserialize non-200 responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolay Dolzhenkov committed Aug 3, 2022
1 parent 6e9a025 commit 8e2f90f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ Client.prototype.methodCall = function methodCall(method, params, callback) {
return err
}

if (response.statusCode == 404) {
callback(__enrichError(new Error('Not Found')))
}
else {

if (response.statusCode === 200) {
this.headersProcessors.parseResponse(response.headers)

var deserializer = new Deserializer(options.responseEncoding)
Expand All @@ -129,6 +127,8 @@ Client.prototype.methodCall = function methodCall(method, params, callback) {
}
callback(err, result)
})
} else {
callback(__enrichError(new Error(`Non-200 response status code: ${response.statusCode}`)))
}
}.bind(this))

Expand Down

0 comments on commit 8e2f90f

Please sign in to comment.