I followed readme to configure Sentry.
After configuring I created a test that reports an exception. The test passed, but I do not see the exception in Sentry’s list of issues.
What can be wrong?
Reporter:
import 'package:flutter/foundation.dart';
import 'package:sentry/sentry.dart';
class ReporterModule {
final SentryClient _sentry;
final bool outputToConsole;
ReporterModule(String sentryDsn, {this.outputToConsole = true})
: _sentry = sentryDsn == null ? null : SentryClient(dsn: sentryDsn);
void reportError(FlutterErrorDetails details) {
try {
_sentry?.captureException(
exception: details.exception,
stackTrace: details.stack,
);
print(_sentry.toString());
print('Reported exception to sentry.');
} catch (e) {
print('Sending report to sentry.io failed: $e');
} finally {
if (outputToConsole) FlutterError.dumpErrorToConsole(details);
}
}
}
Test:
test('Error reporting completes.', () {
var reporter = ReporterModule(prodConfig.sentryDsn, outputToConsole: false);
reporter.reportError(FlutterErrorDetails(
exception: "test exception", stack: StackTrace.current));
});
Test output:
SentryClient("https://o484150.ingest.sentry.io/api/5536982/store/")
Reported exception to sentry.