Skip to content

Instantly share code, notes, and snippets.

@sirkirby
Last active August 29, 2015 14:02
Show Gist options
  • Save sirkirby/8cf55d6f1368ded0017d to your computer and use it in GitHub Desktop.
Save sirkirby/8cf55d6f1368ded0017d to your computer and use it in GitHub Desktop.
try catch example using the raygun.diagnostics custom trace listener
try {}
catch (Exception e)
{
// any arg of type IList<string> will be treated as tags and any type of IDictionary will be treated as custom data
// any arg of type Exception will be wrapped in the primary raygun exception object
var customData = new Dictionary<string, object> {{"myType", someObject};
var tags = new List<string> { "tag1", "tag1" };
Trace.TraceError("Something bad happened", e, tags, customData);
// or inline with arg just added to a default Dictionary<object, object> object
Trace.TraceError("something bad happened", e, new List<string> {"tag1"}, someParameter, someObject);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment