Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longer stack trace on unhandled error events #5788

Closed
olalonde opened this issue Mar 18, 2016 · 5 comments
Closed

Longer stack trace on unhandled error events #5788

olalonde opened this issue Mar 18, 2016 · 5 comments
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.

Comments

@olalonde
Copy link
Contributor

  • Version: v5.5.0
  • Platform: Darwin mbpro 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64
  • Subsystem: events.js

I am getting the following error in my code:

events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open '/assets/screencast-preview.png'
    at Error (native)

Unfortunately, the stack trace doesn't tell me where the error was produced in the code. I was wondering if there was any way to get a longer stack trace on this or if it isn't possible due to the way events are implemented in Node.js.

@jasnell
Copy link
Member

jasnell commented Mar 18, 2016

Unfortunately I don't believe it is currently possible to get a longer stack trace on this particular set of errors due to the way the callback is disconnected from it's original context. It's definitely something that should be investigated further tho. /cc @bnoordhuis

@jasnell jasnell added the fs Issues and PRs related to the fs subsystem / file system. label Mar 18, 2016
@Fishrock123 Fishrock123 added the feature request Issues that request new features to be added to Node.js. label Mar 18, 2016
@bnoordhuis
Copy link
Member

It's not possible to collect long stack traces efficiently (and that's why node core doesn't do it) but if efficiency is of less concern, try longjohn.

@benjamingr
Copy link
Member

Yeah this is not really something that should belong in core - but userland libraries like longjohn solve it in userland and promise libraries also do it.

@olalonde
Copy link
Contributor Author

Ok, I see, I'm not looking for a crazy long stack trace though, just one or two calls before "at Error (native)". Node core does usually collect and display stack traces longer than this one though it doesn't seem to do so in this particular case (unhandled error event). I understand it might not be possible to do it efficiently though.

@cjihrig
Copy link
Contributor

cjihrig commented Jun 16, 2016

Closing as a won't fix in core. As previously noted, look into longjohn.

@cjihrig cjihrig closed this as completed Jun 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

6 participants