3 ms·
Sure - I don't think anything is really an absolute in programming, and depending on the use case there are all sorts of ways to structure this. But in general
by horsawlarway 4y ago
Sure - I don't think anything is really an absolute in programming, and depending on the use case there are all sorts of ways to structure this.
But in general, if you're making a contract where a promise might reject and using await, you need to be wrapping that code in a try/catch somewhere.
That's the dealio with async/await and promises: you're trading the callback .then().catch() format for try{ await ... }catch(){}.
If you don't want to use try/catch - you need to be making a contract where the failure is not a rejection but an error object. If you want to use rejections, you need to be catching them (in one form or another).