I feel handling Promises in JavaScript is not nice with `then/catch`. It gets messy when there are multiple promises (I often use `async/await` and wrap in a huge `try/catch` block in this case), or there is a huge chunk of code in the resolve function
I notice how Golang handle errors. The error is returned in the same line of code. We handle it, then move on to the next problem. That makes the code easier to read and is more convenient to handle error.
So I make this tiny `go-promise` util library to handle promise better in JavaScript. Feedback are welcome!
I notice how Golang handle errors. The error is returned in the same line of code. We handle it, then move on to the next problem. That makes the code easier to read and is more convenient to handle error.
So I make this tiny `go-promise` util library to handle promise better in JavaScript. Feedback are welcome!