check method

  1. @override
void check(
  1. DcqRegistry registry
)

Implementation

@override
void check(
  DcqRegistry registry,
) {
  registry.addThrowExpression((node) {
    final thrownType = node.expression.staticType;
    if (thrownType is! InterfaceType) return;

    final name = thrownType.element.name;
    if (name == 'String' || name == 'Exception' || name == 'Error') return;

    if (!_hasToStringOverride(thrownType)) {
      reportAtNode(node.expression);
    }
  });
}