Make developing flutter_tools nicer: Use fail instead of throw StateError. (#163094)

Closes https://github.com/flutter/flutter/issues/163091.
This commit is contained in:
Matan Lurey 2025-02-12 09:24:26 -08:00 committed by GitHub
parent e8f34a9eea
commit 90a4323cab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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