Improve test that error codes were generated

It appears that invoking exit with a value other than either zero (0) or
254 causes the test infrastructure to interpret the failure as a failure
in the infrastructure, turning the bot purple rather than red. Thowing
an exception is interpreted correctly, so I believe that this change will
cause a need to regenerate to show up as a red bot.

Change-Id: I01e9fc2bfe09fac3da2a9aade69fabf3abd17179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216260
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer_utilities/lib/tools.dart b/pkg/analyzer_utilities/lib/tools.dart
index abb3375..a072d85 100644
--- a/pkg/analyzer_utilities/lib/tools.dart
+++ b/pkg/analyzer_utilities/lib/tools.dart
@@ -10,6 +10,7 @@
 import 'package:analyzer_utilities/text_formatter.dart';
 import 'package:html/dom.dart' as dom;
 import 'package:path/path.dart';
+import 'package:test/test.dart';
 
 final RegExp trailingSpacesInLineRegExp = RegExp(r' +$', multiLine: true);
 final RegExp trailingWhitespaceRegExp = RegExp(r'[\n ]+$');
@@ -290,7 +291,7 @@
       }
       var generateScript = normalize(joinAll(posix.split(generatorPath)));
       print('  $executable$packageRoot $generateScript ${args.join(" ")}');
-      exit(1);
+      fail('Error codes need to be generated');
     } else {
       print('All generated files up to date.');
     }