From 1aa9fe37c3737a25ec9219b5f265cee664d07d65 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Wed, 28 Feb 2024 08:01:14 -0800 Subject: [PATCH] Improve some exception messaging and comments --- lib/src/tool_runner.dart | 18 ++++++++++++------ lib/src/warnings.dart | 2 +- tool/src/flutter_repo.dart | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/src/tool_runner.dart b/lib/src/tool_runner.dart index a6af687aae..c8d473d363 100644 --- a/lib/src/tool_runner.dart +++ b/lib/src/tool_runner.dart @@ -98,12 +98,18 @@ class ToolRunner { var result = await Process.run(commandPath, args, environment: environment); if (result.exitCode != 0) { - toolErrorCallback('Tool "$name" returned non-zero exit code ' - '(${result.exitCode}) when run as "${commandString()}" from ' - '${pathContext.current}\n' - 'Input to $name was:\n' - '$content\n' - 'Stderr output was:\n${result.stderr}\n'); + var envString = + environment.entries.map((e) => '${e.key}: ${e.value}').join(', '); + toolErrorCallback( + 'Tool "$name" returned non-zero exit code ' + '(${result.exitCode}) when run as "${commandString()}".\n' + ' Working directory: "${pathContext.current}"\n' + ' Env: $envString\n' + ' Input to $name was:\n' + ' $content\n' + ' Stderr output was:\n' + ' ${result.stderr}\n', + ); return ''; } else { return result.stdout as String; diff --git a/lib/src/warnings.dart b/lib/src/warnings.dart index 1f072f3f37..5d0a762de6 100644 --- a/lib/src/warnings.dart +++ b/lib/src/warnings.dart @@ -218,7 +218,7 @@ enum PackageWarning implements Comparable { ), duplicateFile( 'duplicate-file', - 'failed to write file at: {0}', + 'file already written at "{0}"', shortHelp: 'Dartdoc is trying to write to a duplicate filename based on the names ' 'of Dart symbols.', diff --git a/tool/src/flutter_repo.dart b/tool/src/flutter_repo.dart index c2853aaa22..5d7a2dc8ce 100644 --- a/tool/src/flutter_repo.dart +++ b/tool/src/flutter_repo.dart @@ -55,7 +55,7 @@ class FlutterRepo { return FlutterRepo._(flutterPath, env, cacheDart, launcher); } - /// Copies an existing, initialized flutter repo. + /// Copies an existing, initialized flutter repo to [flutterPath]. static Future copyFromExistingFlutterRepo( FlutterRepo originalRepo, String flutterPath, Map env, [String? label]) async {