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

Environment set in config can be dropped if notice.Context is specified #92

Open
mmcdaris opened this issue Jul 16, 2018 · 1 comment
Open
Assignees

Comments

@mmcdaris
Copy link
Member

If you configure your client with an Environment then later specify a context for the notice, the environment can be dropped since the context is replaced.
This makes sense because environment is stored in the context as specified in the api docs.
Maybe the contexts could be merged together instead of the specified one overwriting the exising context?

For example this would probably overwrite the context and drop the environment each time an error is sent:

public void SendNotification(Exception ex)
{
  Sharpbrake.Client.AirbrakeConfig airbrakeConfig = new Sharpbrake.Client.AirbrakeConfig()
  {
    ProjectId = "5555",
    ProjectKey = "asdf1234jklj1234",
    Environment = "sandbox"
  };

  var notifier = new Sharpbrake.Client.AirbrakeNotifier(airbrakeConfig);
  var notice = notifier.BuildNotice(ex);

  notice.Context = new Sharpbrake.Client.Model.Context()
  {
    Avocados = "Yes, Please!",
  };

  notifier.NotifyAsync(notice);
}
@aholovko aholovko self-assigned this Jul 17, 2018
@aholovko
Copy link
Contributor

@mmcdaris Yeah, merging context makes sense. I will evaluate options and consider on the optimal solution here.

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

2 participants