From 755a4b4408e71b716989685c07afaf254ae20bb8 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Tue, 6 Jan 2026 16:33:50 -0500 Subject: [PATCH] [tool] Adjust error message when `downgrade` fails Since `pub downgrade` runs package resolution, failure in that step can simply mean that resolution has failed, rather than indicating a problem with the actual downgrade process. This adjusts the message to make it clear that it's a potential resolver failure, to aid in understanding failures. Fixes https://github.com/flutter/flutter/issues/178815 --- script/tool/lib/src/analyze_command.dart | 4 +++- script/tool/test/analyze_command_test.dart | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/script/tool/lib/src/analyze_command.dart b/script/tool/lib/src/analyze_command.dart index 847da1912864..b06120b6edad 100644 --- a/script/tool/lib/src/analyze_command.dart +++ b/script/tool/lib/src/analyze_command.dart @@ -300,7 +300,9 @@ class AnalyzeCommand extends PackageLoopingCommand { if (getBoolArg(_downgradeFlag)) { if (!await _runPubCommand(package, 'downgrade')) { - return PackageResult.fail(['Unable to downgrade dependencies']); + return PackageResult.fail([ + 'Unable to resolve downgraded dependencies', + ]); } } diff --git a/script/tool/test/analyze_command_test.dart b/script/tool/test/analyze_command_test.dart index 7ac6f4baa686..df1a88ff9d2f 100644 --- a/script/tool/test/analyze_command_test.dart +++ b/script/tool/test/analyze_command_test.dart @@ -613,7 +613,7 @@ void main() { expect( output, containsAllInOrder([ - contains('Unable to downgrade dependencies'), + contains('Unable to resolve downgraded dependencies'), ]), ); });