From b0c82723fccf29a8b0ea115a7ee009f5b5292d75 Mon Sep 17 00:00:00 2001 From: Bryan Oltman Date: Mon, 24 Jun 2024 15:36:32 -0400 Subject: [PATCH] chore(shorebird_cli): don't print error toString on command failure (#2284) --- .../lib/src/shorebird_cli_command_runner.dart | 2 +- .../test/src/shorebird_cli_command_runner_test.dart | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/shorebird_cli/lib/src/shorebird_cli_command_runner.dart b/packages/shorebird_cli/lib/src/shorebird_cli_command_runner.dart index 81c5fafa..992e6171 100644 --- a/packages/shorebird_cli/lib/src/shorebird_cli_command_runner.dart +++ b/packages/shorebird_cli/lib/src/shorebird_cli_command_runner.dart @@ -203,7 +203,7 @@ Engine • revision ${shorebirdEnv.shorebirdEngineRevision}'''); exitCode = error.exitCode; } catch (error, stackTrace) { logger - ..err('$error') + ..detail('$error') ..detail('$stackTrace'); exitCode = ExitCode.software.code; } diff --git a/packages/shorebird_cli/test/src/shorebird_cli_command_runner_test.dart b/packages/shorebird_cli/test/src/shorebird_cli_command_runner_test.dart index 36e3aa22..603fb477 100644 --- a/packages/shorebird_cli/test/src/shorebird_cli_command_runner_test.dart +++ b/packages/shorebird_cli/test/src/shorebird_cli_command_runner_test.dart @@ -260,15 +260,16 @@ Engine • revision $shorebirdEngineRevision''', }); group('on command failure', () { - test('logs a stack trace using detail', () async { - // This will fail due to the release android command missing scoped - // dependencies. + test('logs error and stack trace using detail', () async { + // This will fail with a StateError due to the release android command + // missing scoped dependencies. // Note: the --verbose flag is here for illustrative purposes only. // Because logger is a mock, setting the log level in code does // nothing. await runWithOverrides( () => commandRunner.run(['release', 'android', '--verbose']), ); + verify(() => logger.detail(any(that: contains('Bad state')))).called(1); verify(() => logger.detail(any(that: contains('#0')))).called(1); });