Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Better error message when vita-parse-core is not found #19

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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