From 90a4323cab4e81fac0f71b163a93d6dbea74f2fb Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Wed, 12 Feb 2025 09:24:26 -0800 Subject: [PATCH] Make developing `flutter_tools` nicer: Use `fail` instead of `throw StateError`. (#163094) Closes https://github.com/flutter/flutter/issues/163091. --- packages/flutter_tools/test/src/context.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/test/src/context.dart b/packages/flutter_tools/test/src/context.dart index 4b0aa31fd4..840c71611f 100644 --- a/packages/flutter_tools/test/src/context.dart +++ b/packages/flutter_tools/test/src/context.dart @@ -66,14 +66,14 @@ void testUsingContext( skip, // should default to `false`, but https://github.com/dart-lang/test/issues/545 doesn't allow this }) { if (overrides[FileSystem] != null && overrides[ProcessManager] == null) { - throw StateError( + fail( 'If you override the FileSystem context you must also provide a ProcessManager, ' 'otherwise the processes you launch will not be dealing with the same file system ' 'that you are dealing with in your test.', ); } if (overrides.containsKey(ProcessUtils)) { - throw StateError('Do not inject ProcessUtils for testing, use ProcessManager instead.'); + fail('Do not inject ProcessUtils for testing, use ProcessManager instead.'); } // Ensure we don't rely on the default [Config] constructor which will