Skip to content

Commit 67f48ce

Browse files
committed
Add reasons for all inner exceptions
1 parent 5d56ab5 commit 67f48ce

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

native_toolchain_rust/lib/src/process_runner.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ extension InvokeRustup on ProcessRunner {
5353
String? workingDirectory,
5454
Map<String, String>? environment,
5555
}) async {
56-
late ProcessException lastException;
56+
final failureReasons = <String>[];
57+
ProcessException? firstFailure;
58+
5759
for (final executable in _rustupExecutables) {
5860
try {
5961
return await invoke(
@@ -63,15 +65,16 @@ extension InvokeRustup on ProcessRunner {
6365
environment: environment,
6466
);
6567
} on ProcessException catch (e) {
66-
lastException = e;
68+
firstFailure ??= e;
69+
failureReasons.add('"$executable" (${e.message})');
6770
}
6871
}
6972

7073
throw RustProcessException(
7174
'Failed to invoke rustup; is it installed? '
72-
'Checked the following paths: $_rustupExecutables. '
75+
'Tried ${failureReasons.join(', ')}. '
7376
'For help installing rust, see https://rustup.rs',
74-
inner: lastException,
77+
inner: firstFailure,
7578
);
7679
}
7780
}

0 commit comments

Comments
 (0)