Then must be followed by catch?

eslint has a rule that requires then to be followed by a catch
, but in most cases it does not support how to deal with the err, in catch (err= >. ), so I usually just console.log it
then the question is, is it necessary to follow catch?
as I did above directly console.log (err) does not help the page, the card is still stuck, writing catch is not superfluous?

Apr.28,2021
Is

https://eslint.org/docs/rules/
an official rule?


in nodejs's new standard, all promise error must be explicitly handled, and only warnings are displayed during the current transition phase. Therefore, it is recommended to use promise, that is, what you call then, it is best to add catch.
catch after living in error, or record log or do other processing, so that the whole program will not be abnormal.
when you say that the page is stuck, it is mostly caused by an exception, and after processing, you do not use res.response or res.send or res.redirect to end the request (assuming that you are using other Express, web framework is also similar), causing the page to wait all the time and finally report an error when it times out.

Menu