public void Invoke(dynamic request) { using (SentryCore.PushScope()) { SentryCore.AddBreadcrumb(request.Path, "request-path"); // Change the SentryClient in case the request is to the admin part: if (request.Path.StartsWith("/admin")) { // Within this scope, the _adminClient will be used instead of whatever // client was defined before this point: SentryCore.BindClient(_adminClient); } SentryCore.CaptureException(new Exception("Error at the admin section")); // Else it uses the default client _middleware?.Invoke(request); } // Scope is disposed. }
public void BindClient(ISentryClient client) => SentryCore.BindClient(client);