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

Support for stack traces #3

Closed
Almad opened this issue Aug 27, 2012 · 4 comments
Closed

Support for stack traces #3

Almad opened this issue Aug 27, 2012 · 4 comments

Comments

@Almad
Copy link

Almad commented Aug 27, 2012

Currently, there is no way to provide error objects in a way that will preserve stack traces in sentry.

For pinpointing production errors, that would be great (and is supported by raven-node).

@zzen
Copy link
Contributor

zzen commented Aug 27, 2012

A quick clarification on behalf of @Almad - we're using winston to log errors like:

log.error('Hi, I am a bad error', new Error())

However, winston-sentry sees that the log level is error and automatically creates a new Error() object and logs that. The log function could be just a little more clever and check if the incoming parameters are instanceof Error. In my mind, there are 3 valid signatures:

  • log.error('Hi, I am a bad error') automatically creates a new error object
  • log.error('Hi, I am a bad error', new Error()) uses provided error object
  • log.error(new Error('Hi, I am a bad error')) uses provided error object

@guzru
Copy link
Owner

guzru commented Sep 26, 2012

I'll look into this when I can (cannot say when though), but I thank @zzen for the explanation and the suggestion.
Anyway, AFAIK winston is currently unmantained, so it might be a good idea not to rely on this at least for new projects. I currently do not have time to check out what the situation is.

@shaharke
Copy link
Collaborator

This issue is was resolved in #9, but I still need to publish a newer version to NPM (waiting for @guzru). I suggest to test your code on the master branch and let me know if it works for you. All the use cases you mentioned above are supported as follows:

  • log.error('Hi, I am a bad error'): does not created a new error object. message logged as is
  • log.error('Hi, I am a bad error', new Error()): concatenates the provided message with the message of the Error object. Stack trace supported
  • log.error(new Error('Hi, I am a bad error')): uses message in Error object. Stack trace supported

@shaharke
Copy link
Collaborator

shaharke commented Jun 3, 2014

Version 0.0.6 now supports stack traces as described above

@shaharke shaharke closed this as completed Jun 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants