Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of sentry wrapping http.Client
// Non-confidential feedback for Posse
class SentryHttpClient extends BaseClient {
final Client _inner;
Future<StreamedResponse> send(BaseRequest request) async {
try {
return _inner.send(request);
} catch (error) {
final SentryResponse response = await sentryClient.capture(
event: new Event(
exception: error,
tags: {
'url': request.url.toString(),
'path': request.url.path,
if (!response.isSuccessful) {
print('Failed to report to ${response.error}');
} else {
print('Successfully reported network failure');
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.