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

Add support for sending arbitrary context data #41

Open
joshuap opened this issue Jan 24, 2017 · 1 comment
Open

Add support for sending arbitrary context data #41

joshuap opened this issue Jan 24, 2017 · 1 comment

Comments

@joshuap
Copy link
Member

joshuap commented Jan 24, 2017

In Ruby we can do:

Honeybadger.context({
  foo: 'bar'
})

and/or:

Honeybadger.notify(error, context: {bar: 'baz'})

The first is registered globally and the second is registered only for that exception and merged into the global context.

The context object itself is a map which is sent in the JSON payload for the error under payload['request']['context'].

@JoshAshby
Copy link

In case anyone else is looking for how to do this (as of 1.1.0), I ended up doing:

io.honeybadger.reporter.dto.Context context = new io.honeybadger.reporter.dto.Context();
context.put("thing", "data");
io.honeybadger.reporter.dto.Request request = new io.honeybadger.reporter.dto.Request(context, null, null, null, null);
reporter.reportError(exception, request); // reporter is an instance of HoneybadgerReporter

Which isn't too pretty but works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants