Skip to content

Commit 7988d91

Browse files
authored
Improve some exception messaging and comments (#3691)
1 parent a1610aa commit 7988d91

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

lib/src/tool_runner.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,18 @@ class ToolRunner {
9898
var result =
9999
await Process.run(commandPath, args, environment: environment);
100100
if (result.exitCode != 0) {
101-
toolErrorCallback('Tool "$name" returned non-zero exit code '
102-
'(${result.exitCode}) when run as "${commandString()}" from '
103-
'${pathContext.current}\n'
104-
'Input to $name was:\n'
105-
'$content\n'
106-
'Stderr output was:\n${result.stderr}\n');
101+
var envString =
102+
environment.entries.map((e) => '${e.key}: ${e.value}').join(', ');
103+
toolErrorCallback(
104+
'Tool "$name" returned non-zero exit code '
105+
'(${result.exitCode}) when run as "${commandString()}".\n'
106+
' Working directory: "${pathContext.current}"\n'
107+
' Env: $envString\n'
108+
' Input to $name was:\n'
109+
' $content\n'
110+
' Stderr output was:\n'
111+
' ${result.stderr}\n',
112+
);
107113
return '';
108114
} else {
109115
return result.stdout as String;

lib/src/warnings.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ enum PackageWarning implements Comparable<PackageWarning> {
218218
),
219219
duplicateFile(
220220
'duplicate-file',
221-
'failed to write file at: {0}',
221+
'file already written at "{0}"',
222222
shortHelp:
223223
'Dartdoc is trying to write to a duplicate filename based on the names '
224224
'of Dart symbols.',

tool/src/flutter_repo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class FlutterRepo {
5555
return FlutterRepo._(flutterPath, env, cacheDart, launcher);
5656
}
5757

58-
/// Copies an existing, initialized flutter repo.
58+
/// Copies an existing, initialized flutter repo to [flutterPath].
5959
static Future<FlutterRepo> copyFromExistingFlutterRepo(
6060
FlutterRepo originalRepo, String flutterPath, Map<String, String> env,
6161
[String? label]) async {

0 commit comments

Comments
 (0)