
Braking javascript Promises are such a mess - singularity2001
Just one of many examples of recently silently braking code:<p>balance=web3.eth.getBalance(sender);
console.log(balance.toFixed(3))<p>Used to work, now it prints NaN.
What&#x27;s going on? Well getBalance now returns a Promise. IMHO thats the worst category of bug introduction the industry has seen after the goto keyword.<p>It can&#x27;t even be fixed by simply adding the await keyword, it has to be wrapped in an async function.<p>balance=await web3.eth.getBalance(sender);<p>Top level await is not allowed in node.js.
======
hitripekac
It looks like the API of the library you're using has changed. Before you
update the library you should really check the release notes for braking
changes. For npm, you should probably even look more closly at the releases,
and update carefully, as the quality of libraries ranges from great to "should
not be used in production ever".

