Exception reporting doc to use newly added Activity.SetStatus (#3114)
* Add SetStatus to getting started * Use new Activity Status method for exception reporting docs
This commit is contained in:
parent
a25f2861c2
commit
e8ccab063b
|
|
@ -48,12 +48,12 @@ using (var activity = MyActivitySource.StartActivity("Foo"))
|
|||
}
|
||||
catch (SomeException ex)
|
||||
{
|
||||
activity?.SetStatus(Status.Error);
|
||||
activity?.SetStatus(ActivityStatusCode.Error);
|
||||
DoSomething();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
activity?.SetStatus(Status.Error);
|
||||
activity?.SetStatus(ActivityStatusCode.Error);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ using (var activity = MyActivitySource.StartActivity("Foo"))
|
|||
}
|
||||
catch (SomeException ex)
|
||||
{
|
||||
activity?.SetStatus(Status.Error.WithDescription(ex.message));
|
||||
activity?.SetStatus(ActivityStatusCode.Error, ex.message);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -119,7 +119,7 @@ using (var activity = MyActivitySource.StartActivity("Foo"))
|
|||
}
|
||||
catch (SomeException ex)
|
||||
{
|
||||
activity?.SetStatus(Status.Error.WithDescription(ex.message));
|
||||
activity?.SetStatus(ActivityStatusCode.Error, ex.message);
|
||||
activity?.RecordException(ex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue