why does this mysql error causes nodejs to crash instead of going to the catch function?

后端 未结 3 1919
轻奢々
轻奢々 2021-01-18 11:10

I have a mysql statement that creates an entry, it has a .then function and a .catch function, but when the following error occurs:

T

3条回答
  •  清酒与你
    2021-01-18 11:57

    mysqlConnectionPool.execute is throwing the exception before creating a promise.

    i.e. the exception is not thrown from within the promise.

    To catch it you would need to try {} catch (e) {} around the call to mysqlConnectionPool.execute.

提交回复
热议问题