Unverified Commit d1411a16 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Remove unused FlutterErrorDetails subclasses (#61579)

parent c6dce231
......@@ -80,18 +80,17 @@ class PointerRouter {
InformationCollector collector;
assert(() {
collector = () sync* {
yield DiagnosticsProperty<PointerEvent>('Event', event, style: DiagnosticsTreeStyle.errorProperty);
yield DiagnosticsProperty<PointerRouter>('router', this, level: DiagnosticLevel.debug);
yield DiagnosticsProperty<PointerRoute>('route', route, level: DiagnosticLevel.debug);
yield DiagnosticsProperty<PointerEvent>('event', event, level: DiagnosticLevel.debug);
};
return true;
}());
FlutterError.reportError(FlutterErrorDetailsForPointerRouter(
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
stack: stack,
library: 'gesture library',
context: ErrorDescription('while routing a pointer event'),
router: this,
route: route,
event: event,
informationCollector: collector
));
}
......@@ -126,48 +125,3 @@ class PointerRouter {
});
}
}
/// Variant of [FlutterErrorDetails] with extra fields for the gestures
/// library's pointer router ([PointerRouter]).
///
/// See also:
///
/// * [FlutterErrorDetailsForPointerEventDispatcher], which is also used
/// by the gestures library.
class FlutterErrorDetailsForPointerRouter extends FlutterErrorDetails {
/// Creates a [FlutterErrorDetailsForPointerRouter] object with the given
/// arguments setting the object's properties.
///
/// The gestures library calls this constructor when catching an exception
/// that will subsequently be reported using [FlutterError.onError].
const FlutterErrorDetailsForPointerRouter({
dynamic exception,
StackTrace stack,
String library,
DiagnosticsNode context,
this.router,
this.route,
this.event,
InformationCollector informationCollector,
bool silent = false,
}) : super(
exception: exception,
stack: stack,
library: library,
context: context,
informationCollector: informationCollector,
silent: silent,
);
/// The pointer router that caught the exception.
///
/// In a typical application, this is the value of [GestureBinding.pointerRouter] on
/// the binding ([GestureBinding.instance]).
final PointerRouter router;
/// The callback that threw the exception.
final PointerRoute route;
/// The pointer event that was being routed when the exception was raised.
final PointerEvent event;
}
......@@ -242,11 +242,10 @@ mixin DebugOverflowIndicatorMixin on RenderObject {
// TODO(jacobr): add the overflows in pixels as structured data so they can
// be visualized in debugging tools.
FlutterError.reportError(
FlutterErrorDetailsForRendering(
FlutterErrorDetails(
exception: FlutterError('A $runtimeType overflowed by $overflowText.'),
library: 'rendering library',
context: ErrorDescription('during layout'),
renderObject: this,
informationCollector: () sync* {
if (debugCreator != null)
yield DiagnosticsDebugCreator(debugCreator);
......
......@@ -1319,12 +1319,11 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
dynamic debugCreator;
void _debugReportException(String method, dynamic exception, StackTrace stack) {
FlutterError.reportError(FlutterErrorDetailsForRendering(
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
stack: stack,
library: 'rendering library',
context: ErrorDescription('during $method()'),
renderObject: this,
informationCollector: () sync* {
if (debugCreator != null)
yield DiagnosticsDebugCreator(debugCreator);
......@@ -3384,35 +3383,6 @@ mixin RelayoutWhenSystemFontsChangeMixin on RenderObject {
}
}
/// Variant of [FlutterErrorDetails] with extra fields for the rendering
/// library.
class FlutterErrorDetailsForRendering extends FlutterErrorDetails {
/// Creates a [FlutterErrorDetailsForRendering] object with the given
/// arguments setting the object's properties.
///
/// The rendering library calls this constructor when catching an exception
/// that will subsequently be reported using [FlutterError.onError].
const FlutterErrorDetailsForRendering({
dynamic exception,
StackTrace stack,
String library,
DiagnosticsNode context,
this.renderObject,
InformationCollector informationCollector,
bool silent = false,
}) : super(
exception: exception,
stack: stack,
library: library,
context: context,
informationCollector: informationCollector,
silent: silent,
);
/// The RenderObject that was being processed when the exception was caught.
final RenderObject renderObject;
}
/// Describes the semantics information a [RenderObject] wants to add to its
/// parent.
///
......
......@@ -153,6 +153,17 @@ void main() {
FlutterError.onError = previousErrorHandler;
});
test('Exceptions include router, route & event', () {
try {
final PointerRouter router = PointerRouter();
router.addRoute(2, (PointerEvent event) => throw 'Pointer exception');
} catch (e) {
expect(e, contains('router: Instance of \'PointerRouter\''));
expect(e, contains('route: Closure: (PointerEvent) => Null'));
expect(e, contains('event: PointerDownEvent#[a-zA-Z0-9]{5}(position: Offset(0.0, 0.0))'));
}
});
test('Should transform events', () {
final List<PointerEvent> events = <PointerEvent>[];
final List<PointerEvent> globalEvents = <PointerEvent>[];
......
......@@ -47,7 +47,7 @@ class StructuredErrorTestService extends TestWidgetInspectorService {
expect(flutterErrorEvents, hasLength(0));
// Create an error.
FlutterError.reportError(FlutterErrorDetailsForRendering(
FlutterError.reportError(FlutterErrorDetails(
library: 'rendering library',
context: ErrorDescription('during layout'),
exception: StackTrace.current,
......
......@@ -76,7 +76,7 @@ class StructureErrorTestWidgetInspectorService extends Object with WidgetInspect
equals('true'));
// Creates an error.
final FlutterErrorDetails expectedError = FlutterErrorDetailsForRendering(
final FlutterErrorDetails expectedError = FlutterErrorDetails(
library: 'rendering library',
context: ErrorDescription('during layout'),
exception: StackTrace.current,
......
......@@ -2356,7 +2356,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
equals('true'));
// Create an error.
FlutterError.reportError(FlutterErrorDetailsForRendering(
FlutterError.reportError(FlutterErrorDetails(
library: 'rendering library',
context: ErrorDescription('during layout'),
exception: StackTrace.current,
......@@ -2379,7 +2379,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
'══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞════════════'));
// Send a second error.
FlutterError.reportError(FlutterErrorDetailsForRendering(
FlutterError.reportError(FlutterErrorDetails(
library: 'rendering library',
context: ErrorDescription('also during layout'),
exception: StackTrace.current,
......@@ -2407,7 +2407,7 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
binding.postTest();
// Send another error.
FlutterError.reportError(FlutterErrorDetailsForRendering(
FlutterError.reportError(FlutterErrorDetails(
library: 'rendering library',
context: ErrorDescription('during layout'),
exception: StackTrace.current,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment