sentry_link 0.1.2 icon indicating copy to clipboard operation
sentry_link: ^0.1.2 copied to clipboard

Automatic capture of exceptions and GraphQL errors for the gql eco-system, like graphql and ferry

example/example.dart

import 'dart:io';

import 'package:graphql/client.dart';
import 'package:sentry/sentry.dart';
import 'package:sentry_link/sentry_link.dart';

Future<void> main() {
  return Sentry.init(
    (options) {
      options.dsn =
          'https://c8f216b28d814d2ca83e52fb735da535@o266569.ingest.sentry.io/5558444';
      options.addEventProcessor(GqlEventProcessor());
      options.tracesSampleRate = 1;
    },
    appRunner: example,
  );
}

Future<void> example() async {
  final link = Link.from([
    SentryLink.link(),
    SentryTracingLink(shouldStartTransaction: true),
    HttpLink(
      'https://api.chat.graphql-flutter.dev/graphql',
      httpClient: SentryHttpClient(networkTracing: true),
      parser: SentryResponseParser(),
      serializer: SentryRequestSerializer(),
    ),
  ]);

  final client = GraphQLClient(
    cache: GraphQLCache(),
    link: link,
  );

  final QueryOptions options = QueryOptions(
    operationName: 'ReadChats',
    document: gql(
      r'''
        query ExampleQuery {
          getChats {
            # intentionally missing the 'e' from name
            nam
          }
        }
      ''',
    ),
  );

  final result = await client.query(options);
  print(result.toString());
  await Future<void>.delayed(Duration(seconds: 2));
  exit(0);
}
0
likes
130
pub points
56%
popularity

Publisher

verified publisher iconuekoetter.dev

Automatic capture of exceptions and GraphQL errors for the gql eco-system, like graphql and ferry

Repository (GitHub)
View/report issues

Documentation

API reference

Funding

Consider supporting this project:

github.com
www.buymeacoffee.com

License

Icon for licenses.Apache-2.0 (LICENSE)

Dependencies

gql, gql_error_link, gql_exec, gql_link, sentry

More

Packages that depend on sentry_link