NodeJS 节点mssql完成堆栈跟踪

luaexgnf  于 2023-03-01  发布在  Node.js
关注(0)|答案(1)|浏览(139)

为什么我没有得到一个指向文件执行点的stacktrace

const sqlSelect = "error";
 
const result = await sql.query(sqlSelect);

结果:

err = new RequestError(err, 'EREQUEST')
          ^

RequestError: Could not find stored procedure 'error'.
    at handleError (...\node_modules\mssql\lib\tedious\request.js:384:15)
    at Connection.emit (node:events:513:28)
    at Connection.emit (..\node_modules\tedious\lib\connection.js:1048:18)
    at RequestTokenHandler.onErrorMessage (...\node_modules\tedious\lib\token\handler.js:365:21)
    at Readable.<anonymous> (...\node_modules\tedious\lib\token\token-stream-parser.js:26:33)
    at Readable.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10)
    at next (node:internal/streams/from:98:31) {
lg40wkob

lg40wkob1#

在文档中找到此信息
重要提示:始终在创建的连接上附加一个错误侦听器。无论何时连接出错,它都会发出错误,如果没有侦听器,它会使应用程序崩溃,并显示未捕获的错误。
所以我做了一个

process.on('uncaughtException', (err) => {
  //Error handeling
});

相关问题