jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 769 forks source link

How to catch errors of an order and execute some code if success ? #817

Open joyboy67 opened 2 years ago

joyboy67 commented 2 years ago

Hello,

I tried to catch errors with then()/catch()

like that

client.futuresMarketBuy('ETHUSDT', 100 )
.then(() => { execute_some_code })
.catch(err => console.log(err)

But I don't get any errors in console log in case fail nor the then() executed in case success

In summary I would like to execute some code in case of success of the promise or display the errors in the console like {code: -2019, msg: 'Margin is insufficient'}

Thank you :)