javascript - Node.js errors fail silently -
i jumping onto node.js project errors fail silently , app doesn't throw errors unless put in try..catch block. example:
console.log(ok) // doesn't throw errors during runtime; api fails silently.
try { console.log(ok) } catch(e) { console.log(e)// throws referenceerror: ok not defined } does know why might be?
thank in advance!
does know why might be?
clearly, code in containing scope catching , suppressing errors. unfortunate, common, practice.
sadly you'll have root out code, there's no real shortcut. run --inspect (on recent versions of node) , tell debugger stop on all exceptions, caught ones, may track them down some. it's going tedious, i'm afraid.
one possible further thought: on only-slightly-older versions of node, unhandled promise rejections not reported. if code inside (say) promise executor (the function pass new promise) or then or catch handler (or async function), throw being converted promise rejection. latest versions of node report unhandled promise rejections. (in not-distant-future, they'll terminate node process.)
Comments
Post a Comment