Skip to content

Commit

Permalink
braziliex: success exists only in private api responses
Browse files Browse the repository at this point in the history
  • Loading branch information
kornrunner committed Jan 11, 2018
1 parent e7bd017 commit 42a001d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/braziliex.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,14 @@ module.exports = class braziliex extends Exchange {

async request (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
let response = await this.fetch2 (path, api, method, params, headers, body);
let success = this.safeInteger (response, 'success');
if (success == 0) {
let message = this.safeString (response, 'message');
if (message == 'Invalid APIKey')
throw new AuthenticationError (message);
throw new ExchangeError (message);
if ('success' in response) {
let success = this.safeInteger (response, 'success');
if (success == 0) {
let message = this.safeString (response, 'message');
if (message == 'Invalid APIKey')
throw new AuthenticationError (message);
throw new ExchangeError (message);
}
}
return response;
}
Expand Down

0 comments on commit 42a001d

Please sign in to comment.