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

How to set context? #2905

Closed
gajus opened this issue Sep 15, 2020 · 2 comments
Closed

How to set context? #2905

gajus opened this issue Sep 15, 2020 · 2 comments

Comments

@gajus
Copy link
Contributor

gajus commented Sep 15, 2020

I've read documentation cover-to-cover and I am still clueless how to set contexts using captureException.

Looking at the source code, it looks like it should be as simple as:

captureException(new Error('baz'), {
  contexts: {
    foo: 'bar',
  },
});

But the foo=bar values do not appear anywhere in the UI.

It is either an issue with documentation/ SDK or UI.

@gajus
Copy link
Contributor Author

gajus commented Sep 15, 2020

Okay, so after posting this, I realised that maybe it expects a nested object for whatever reason. So I tried:

captureException(new Error('baz'), {
  contexts: {
    foo: {
      bar: {
        taz: 'qux',
      },
    },
  },
});

This indeed works:

Screen Shot 2020-09-15 at 9 15 37 AM

Lack of documentation.

@gajus gajus closed this as completed Sep 15, 2020
@gajus
Copy link
Contributor Author

gajus commented Sep 15, 2020

At the very least, I would correct types to say:

contexts: { [key: string]: { [key: string]: any } };

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

1 participant