I’m error-managing a lot of async functions (mostly API calls), so I’m wondering if there’s some difference between these two error catching methods:
<code>anyAsyncFunction().then().catch((err) => handleError(err))
</code>
<code>anyAsyncFunction().then().catch((err) => handleError(err))
</code>
anyAsyncFunction().then().catch((err) => handleError(err))
<code>anyAsyncFunction().then(() => {
// logic
}, (err) => handleError(err))
</code>
<code>anyAsyncFunction().then(() => {
// logic
}, (err) => handleError(err))
</code>
anyAsyncFunction().then(() => {
// logic
}, (err) => handleError(err))
I’ve seen both of these being used and have not yet understood the difference between them.
1