try/catch and callback confusion
Closed this issue · 2 comments
dutu commented
callback is called in the try statement in BitX.js at line 72.
If the callback function throws an exception, then callback is executed again in catch.
Possible solution
try {
response = JSON.parse(response);
} catch (err) {
callback(err);
return;
}
if (response["error"]) {
callback(new Error(response.error));
} else {
callback(null, response);
}
bausmeier commented
Thanks for pointing that out - it should be fixed now.
dutu commented
Looks good. Thanks for the fast response and fix