blob: a8e8545e461031af281211093c9a94c61d49710a [file]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/instrumentation/noop_service.dart';
import 'package:analyzer/instrumentation/plugin_data.dart';
import 'package:telemetry/crash_reporting.dart';
class CrashReportingInstrumentation extends NoopInstrumentationService {
final CrashReportSender reporter;
CrashReportingInstrumentation(this.reporter);
@override
void logException(dynamic exception, [StackTrace stackTrace]) {
reporter.sendReport(exception,
stackTrace: stackTrace ?? StackTrace.current);
}
@override
void logPluginException(
PluginData plugin, dynamic exception, StackTrace stackTrace) {
// TODO(mfairhurst): send plugin information too.
reporter.sendReport(exception, stackTrace: stackTrace);
}
}