Hopefully this will clarify:
> var er = new Error('foo');
undefined
> er.toString()
'Error: foo'
> er.message
'foo'
> er.stack
'Error: foo\n at repl:1:10\n at REPLServer.self.eval
(repl.js:110:21)\n at repl.js:249:20\n at REPLServer.self.eval
(repl.js:122:7)\n at Interface.<anonymous> (repl.js:239:12)\n at
Interface.EventEmitter.emit (events.js:95:17)\n at Interface._onLine
(readline.js:202:10)\n at Interface._line (readline.js:531:8)\n at
Interface._ttyWrite (readline.js:760:14)\n at ReadStream.onkeypress
(readline.js:99:10)'
> *er.stack.split('\n').forEach(function (line) { console.log(line); });*
Error: foo
at repl:1:10
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
Cheers,
Gus
On Tue, Jul 21, 2015 at 3:46 PM, Robert Steckroth <[email protected]
> wrote:
> Some nodejs errors are not very informative. How can I get nodejs to print
> line numbers and stack trace for this error?
>
> Exaple ouptut of nodejs error to satdout ->
> *Cannot read property 'sp' of undefined*
>
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/e9a85f84-c35d-4420-a081-be0acaa84423%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/e9a85f84-c35d-4420-a081-be0acaa84423%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/CAJkwh4Ln1i0STktEj7JVa6aAJYZJ%3DxwSVnMGvgCFgWKCLKsHEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.