chore(shorebird_cli): don't print error toString on command failure (#2284)

This commit is contained in:
Bryan Oltman
2024-06-24 15:36:32 -04:00
committed by GitHub
parent 044f2fcca5
commit b0c82723fc
2 changed files with 5 additions and 4 deletions
@@ -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;
}
@@ -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);
});