dart_style
dart_style copied to clipboard
Improve error message in sanity check
If the formatter detects that it erroneously makes a non-whitespace change, it aborts with an exception asking users to file a bug. In many cases, the reason it gets into that situation is because syntactically invalid code was erroneously accepted by the parser without reporting an error, which the formatter then dutifully formats into something that is valid.
Updating the sanity check error message to suggest users double check that their code is correct might help them diagnose the problem.
See: https://github.com/dart-lang/sdk/issues/48664#issuecomment-1088771021