Prefer calling then
and catch
separately to combining them into a single then
#217
Labels
then
and catch
separately to combining them into a single then
#217
Essentially,
Promise.prototype.then
allows taking in two arguments to respond to both resolved and rejected promises. Essentially,p.then(f, g)
is equivalent top.catch(g).then(f)
; note that the catch comes first since errors thrown by thethen
handler are not caught by thecatch
handler.It would be nice to automatically replace instances like this since it makes it easier to visually scan for
catch
to check if an error is handled. It also helps emphasise the fact that thethen
is not handled by thecatch
, which isn't as apparent when it's ordered visually after thethen
handler.The text was updated successfully, but these errors were encountered: