Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Go-promise – Golang's style to handle promises/error in JavaScript (github.com/hieunc229)
4 points by docuru on Dec 3, 2021 | hide | past | favorite | 1 comment



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!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: