Skip to content

Commit 42d93f7

Browse files
authored
fix: Better error message when vita-parse-core is not found (#19)
1 parent 8af5c33 commit 42d93f7

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/check.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
use std::{
22
collections::HashMap,
33
env,
4-
process::{self, Command, Stdio},
4+
process::{Command, Stdio},
55
};
66

7-
use anyhow::{anyhow, Context};
8-
use log::error;
7+
use anyhow::{anyhow, bail, Context};
98
use rustc_version::Channel;
109

1110
pub fn rust_version() -> anyhow::Result<()> {
1211
let rust_version = rustc_version::version_meta()?;
1312

1413
if rust_version.channel > Channel::Nightly {
15-
error!(
14+
bail!(
1615
"cargo-vita requires a nightly rustc version. Do one of the following:\n \
1716
- Run `rustup override set nightly` to use nightly in the current directory\n \
1817
- Run cargo with +nightly flag.\n \
@@ -21,7 +20,6 @@ pub fn rust_version() -> anyhow::Result<()> {
2120
channel = \"nightly\"\n \
2221
components = [ \"rust-src\" ]"
2322
);
24-
process::exit(1);
2523
}
2624

2725
Ok(())

src/commands/coredump.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,19 @@ impl Executor for Coredump {
115115

116116
info!("{}: {command:?}", "Parsing coredump".blue());
117117

118-
if !command.status()?.success() {
118+
let status = command.status();
119+
120+
if let Err(err) = &status {
121+
if err.kind() == io::ErrorKind::NotFound {
122+
bail!(
123+
"`vita-parse-core` not found. \
124+
Ensure this tool is installed from https://github.com/xyzz/vita-parse-core \
125+
and is available in your PATH."
126+
);
127+
}
128+
}
129+
130+
if !status?.success() {
119131
bail!("vita-parse-core failed");
120132
}
121133
} else {

0 commit comments

Comments
 (0)