简体   繁体   中英

node.js ParseError - which file is the error thrown in?

I've got quite a big library written in node.js, too big to paste here (>20 files). I've got a try..catch that catches the error, I debug the catch part and I console.log the error as below:

{ [ParseError: value.key.split is not a function] message: 'value.key.split is not a function', path: [ 'properties', 'statement1' ], name: 'ParseError' }

The thing is - I don't know which file is that and I'm somehow unable to debug it. Can I access the source file (line, preferably) where this error was thrown? What node.js returns is the actual line that it tried to execute, but I can hardly spot where it is... Any suggestions would be welcome.

Try

console.dir( error );

on error instead. You also might try logging the stack property explicitly:

console.log( error.stack );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM