Skip to content

Commit

Permalink
quoinex: account that Python/PHP do not parse json upfront (yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkutny committed Jan 30, 2018
1 parent 47d67da commit bed18c1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions js/qryptos.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,24 @@ module.exports = class qryptos extends Exchange {
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
}

handleErrors (code, reason, url, method, headers, body, response) {
handleErrors (code, reason, url, method, headers, body, response = undefined) {
if (code >= 200 && code <= 299)
return;
const messages = this.exceptions.messages;
const feedback = this.id + ' ' + this.json (response);
if (code === 401) {
// expected non-json response
if (body in messages)
throw new messages[body] (this.id + ' ' + body);
} else if (code === 404) {
else
return;
}
if (typeof response === 'undefined')
if ((body[0] === '{') || (body[0] === '['))
response = JSON.parse (body);
else
return;
const feedback = this.id + ' ' + this.json (response);
if (code === 404) {
// { "message": "Order not found" }
const message = this.safeString (response, 'message');
if (message in messages)
Expand Down

0 comments on commit bed18c1

Please sign in to comment.