raven-node icon indicating copy to clipboard operation
raven-node copied to clipboard

Add Stacktrace Option to CaptureMessage

Open BigPrimeNumbers opened this issue 8 years ago • 4 comments

It'd be great to have the option with the method captureMessage to enable a stack trace, similar to raven-js. As of right now, it appears that captureException is the only way to get a stack trace.

BigPrimeNumbers avatar Jun 15 '17 18:06 BigPrimeNumbers

I think this makes sense, but not going to be a high priority issue right away. Thanks @BigPrimeNumbers

MaxBittker avatar Jun 16 '17 19:06 MaxBittker

@BigPrimeNumbers done https://github.com/getsentry/raven-node/pull/388 Should be released on Monday morning.

kamilogorek avatar Oct 06 '17 10:10 kamilogorek

Very nice to see implemented, though it looks to only be supported via a global flag being set (so all calls to captureMessage will attempt to get a stacktrace if so). Maybe adding a check for it in the options sent to captureMessage would be good as well?

raven-js version of captureMessage: https://github.com/getsentry/raven-js/blob/master/src/raven.js#L498

captureMessage: function(msg, options) {

    ...

    if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
      options = objectMerge(
        {
          // fingerprint on msg, not stack trace (legacy behavior, could be
          // revisited)
          fingerprint: msg,
          // since we know this is a synthetic trace, the top N-most frames
          // MUST be from Raven.js, so mark them as in_app later by setting
          // trimHeadFrames
          trimHeadFrames: (options.trimHeadFrames || 0) + 1
        },
        options
      );

     ...

BigPrimeNumbers avatar Oct 25 '17 18:10 BigPrimeNumbers

This is easily doable and actually will help us unify both codebases. Reopened.

kamilogorek avatar Oct 27 '17 12:10 kamilogorek