Jer*_*emy 6 node.js node-mysql
我刚刚将我的节点 api 切换为使用node-mysql。它不断抑制我的错误/堆栈跟踪,使开发和调试成为一场噩梦。例如,我正在编写一个新功能,但出现此错误:
/opt/figo/banking/node_modules/mysql/lib/protocol/Parser.js:78
throw err; // Rethrow non-MySQL errors
^
TypeError: string is not a function
Run Code Online (Sandbox Code Playgroud)
该mysql模块是必不可少的重新措辞我的原始错误消息。我怎样才能让它停止这样做?我只想确切地看到它失败的地方,而不是node-mysql决定重新抛出我的错误的地方。
如果您抛出错误,它应该是一个有效的错误对象。我认为您正在抛出字符串。尝试这个
throw new Error("oops something happened");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10763 次 |
| 最近记录: |