Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 681e457

Browse files
committed
Added documentation about the Exception.Data support
1 parent 815c7f1 commit 681e457

2 files changed

Lines changed: 37 additions & 3 deletions

File tree

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,26 @@ ravenClient.CaptureMessage("Hello World!");
3232

3333
Additional Data
3434
---------------
35-
The capture methods allow you to provide additional data to be sent with your request. `CaptureException` supports both the
36-
`tags` and `extra` properties, and `CaptureMessage` additionally supports the `level` property.
35+
You can add additional data to the [`Exception.Data`](https://msdn.microsoft.com/en-us/library/system.exception.data.aspx)
36+
property on exceptions thrown about in your solution:
37+
38+
```csharp
39+
try
40+
{
41+
// ...
42+
}
43+
catch (Exception exception)
44+
{
45+
exception.Data.Add("SomeKey", "SomeValue");
46+
throw;
47+
}
48+
```
49+
50+
The data `SomeKey` and `SomeValue` will be captured and presented in the `extra` property on Sentry.
51+
52+
Additionally, the capture methods allow you to provide additional data to be sent with your request.
53+
`CaptureException` supports both the `tags` and `extra` properties, and `CaptureMessage` additionally
54+
supports the `level` property.
3755

3856
The full argument specs are:
3957

@@ -123,7 +141,7 @@ the property `ErrorOnCapture`:
123141

124142
```csharp
125143
ravenClient.ErrorOnCapture = exception => {
126-
// custom code here
144+
// custom code here
127145
};
128146
````
129147

docs/index.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,22 @@ You can capture a message without being bound by an exception:
6161
Additional Data
6262
---------------
6363

64+
You can add additional data to the `Exception.Data <https://msdn.microsoft.com/en-us/library/system.exception.data.aspx>`
65+
property on exceptions thrown about in your solution:
66+
67+
.. sourcecode:: csharp
68+
69+
try
70+
{
71+
// ...
72+
}
73+
catch (Exception exception)
74+
{
75+
exception.Data.Add("SomeKey", "SomeValue");
76+
throw;
77+
}
78+
79+
6480
The capture methods allow you to provide additional data to be sent with
6581
your request. ``CaptureException`` supports both the ``tags`` and extra
6682
``properties``, and ``CaptureMessage`` additionally supports the

0 commit comments

Comments
 (0)