Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throwing whenever the statusCode != 200 causes issues #57

Closed
keyle opened this issue Jan 14, 2018 · 4 comments
Closed

throwing whenever the statusCode != 200 causes issues #57

keyle opened this issue Jan 14, 2018 · 4 comments

Comments

@keyle
Copy link

keyle commented Jan 14, 2018

There is no way (AFAIK) to embed your API in Promises, when you simply throw the response on L.89.

try catch, or Promise rejection won't get it, and it will just throw and fail.

Recommend you remove L.89 or use Promises instead of a callback.

if ( response && response.statusCode !== 200 ) throw response;

@keyle
Copy link
Author

keyle commented Jan 14, 2018

Example

try {
    binance.marketSell(instrument, balances[coin].available, function (response) {
        resolve(response);
    });
} catch (error) {
    reject(error);
}

is the statusCode is different than 200, e.g. Insufficient funds or Lot size, it will just spew it, without catching it in the try/catch, or being able to reject or resolve the promise.

@jaggedsoft
Copy link
Owner

jaggedsoft commented Jan 14, 2018

Yes thank you for the suggestion, I agree and this will be fixed in v0.4.0
The only reason it has not been fixed is because it's a breaking change

Hopefully this release will come soon. Life has kept me busy recently

@keyle
Copy link
Author

keyle commented Jan 14, 2018

Thanks for the quick response. All the best 👍

@jaggedsoft
Copy link
Owner

New release available: v0.4.0 b5d8107
Thanks for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants