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

captureMessage does not send context's additional data #284

Closed
ironsidevsquincy opened this issue Nov 4, 2014 · 1 comment · May be fixed by CrowdStrike/raven-js#1
Closed

captureMessage does not send context's additional data #284

ironsidevsquincy opened this issue Nov 4, 2014 · 1 comment · May be fixed by CrowdStrike/raven-js#1

Comments

@ironsidevsquincy
Copy link

Couldn't find an issue relating to this, so...

When using context to wrap a function call, with additional data, e.g.

Raven.context(
    { tags: { foo: 'bar' } },
    myFunc
);

if Raven.captureMessage is called from within myFunc, the tag foo is not sent up to sentry

Looks like it only sends the global options - https://github.com/getsentry/raven-js/blob/master/src/raven.js#L659

Is this expected behaviour?

@benvinegar
Copy link
Contributor

It is expected, albeit perhaps not straightforward.

context basically produces a function that does this:

try {
  myFunc.apply(this, arguments);
} catch (e) {
  Raven.captureException(e, { tags: { foo: 'bar' } });
}

If inside myFunc, Raven.captureException is called (but doesn't throw an exception), it has no knowledge of the tags you've set higher in the stack via context. context is just an alternate form of wrap, and poorly named; it doesn't "set a context" that is interpreted further below.

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

Successfully merging a pull request may close this issue.

2 participants