diff --git a/pkg/front_end/lib/src/testing/id_testing_helper.dart b/pkg/front_end/lib/src/testing/id_testing_helper.dart
index d1b064ac46d1..75dcc27c8642 100644
--- a/pkg/front_end/lib/src/testing/id_testing_helper.dart
+++ b/pkg/front_end/lib/src/testing/id_testing_helper.dart
@@ -61,8 +61,8 @@ class CfeTestConfig extends TestConfig {
 
   /// Called after running test on [testData] with the resulting
   /// [testResultData].
-  void onCompilationResult(
-      TestData testData, CfeTestResultData testResultData) {}
+  void onCompilationResult(MarkerOptions markerOptions, TestData testData,
+      CfeTestResultData testResultData) {}
 }
 
 abstract class CfeDataComputer<T> extends DataComputer<T, CfeTestConfig,
@@ -229,7 +229,7 @@ Future<TestResult<T>> runTestForConfig<T>(MarkerOptions markerOptions,
 
   CfeTestResultData testResultData =
       new CfeTestResultData(config, customData, compilerResult);
-  config.onCompilationResult(testData, testResultData);
+  config.onCompilationResult(markerOptions, testData, testResultData);
   return processCompiledResult(
       markerOptions, testData, dataComputer, testResultData, errors,
       fatalErrors: fatalErrors,
diff --git a/pkg/front_end/test/macros/application/macro_application_test.dart b/pkg/front_end/test/macros/application/macro_application_test.dart
index 25a5d512dbf0..a071de051c69 100644
--- a/pkg/front_end/test/macros/application/macro_application_test.dart
+++ b/pkg/front_end/test/macros/application/macro_application_test.dart
@@ -71,7 +71,7 @@ class MacroTestConfig extends CfeTestConfig {
   }
 
   @override
-  Future<void> onCompilationResult(
+  Future<void> onCompilationResult(MarkerOptions markerOptions,
       TestData testData, CfeTestResultData testResultData) async {
     Component component = testResultData.compilerResult.component!;
     StringBuffer buffer = new StringBuffer();
@@ -95,19 +95,28 @@ class MacroTestConfig extends CfeTestConfig {
           file.writeAsStringSync(actual);
         } else {
           String diff = await runDiff(expectedUri, actual);
-          throw "${testData.name} don't match ${expectedUri}\n$diff";
+          print("ERROR: ${testData.name} don't match ${expectedUri}\n$diff");
+          onFailure(generateErrorMessage(markerOptions, mismatches: {
+            testData.name: {testResultData.config.marker}
+          }));
         }
       }
     } else if (generateExpectations) {
       file.writeAsStringSync(actual);
     } else {
-      throw 'Please use -g option to create file ${expectedUri} with this '
-          'content:\n$actual';
+      print('Please use -g option to create file ${expectedUri} with this '
+          'content:\n$actual');
+      onFailure(generateErrorMessage(markerOptions, errors: {
+        testData.name: {testResultData.config.marker}
+      }));
     }
     if (offsetErrors.isNotEmpty) {
       offsetErrors.forEach(print);
       offsetErrors.clear();
-      throw "${testData.name} has macro offset errors.";
+      print("ERROR: ${testData.name} has macro offset errors.");
+      onFailure(generateErrorMessage(markerOptions, errors: {
+        testData.name: {testResultData.config.marker}
+      }));
     }
   }
 }