Skip to content

Commit

Permalink
fix: Better error message when vita-parse-core is not found (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikarh authored Apr 2, 2024
1 parent 8af5c33 commit 42d93f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/check.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
use std::{
collections::HashMap,
env,
process::{self, Command, Stdio},
process::{Command, Stdio},
};

use anyhow::{anyhow, Context};
use log::error;
use anyhow::{anyhow, bail, Context};
use rustc_version::Channel;

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

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

Ok(())
Expand Down
14 changes: 13 additions & 1 deletion src/commands/coredump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,19 @@ impl Executor for Coredump {

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

if !command.status()?.success() {
let status = command.status();

if let Err(err) = &status {
if err.kind() == io::ErrorKind::NotFound {
bail!(
"`vita-parse-core` not found. \
Ensure this tool is installed from https://github.com/xyzz/vita-parse-core \
and is available in your PATH."
);
}
}

if !status?.success() {
bail!("vita-parse-core failed");
}
} else {
Expand Down

0 comments on commit 42d93f7

Please sign in to comment.