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

后端 未结 3 1957
轻奢々
轻奢々 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:49

    Well,

    I'm guessing that you are using the standard mysql package which it seems not supporting Promises, instead, it accepts a standard node callback function(err, results, fields) {} as an argument of the execute method.

    So since you haven't defined a valid callback the script will just throw an exception.

提交回复
热议问题