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

Provide a user-friendly error message when Cargo.toml is not found #733

Closed
imotai opened this issue May 14, 2024 · 2 comments · Fixed by #1459
Closed

Provide a user-friendly error message when Cargo.toml is not found #733

imotai opened this issue May 14, 2024 · 2 comments · Fixed by #1459

Comments

@imotai
Copy link

imotai commented May 14, 2024

Description:

When running cargo-prove prove build and Cargo.toml is not found in the current directory or any parent directory, the current error message is:

thread 'main' panicked at cli/src/build.rs:27:40:
called `Result::unwrap()` on an `Err` value: CargoMetadata { stderr: "error: could not find `Cargo.toml` in `/mnt/ssd3/opensource` or any parent directory\n" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Suggestion:

Instead of the current error message, we can follow the error message from cargo build

error: could not find `Cargo.toml` in `/mnt/ssd3/opensource` or any parent directory

Related code

sp1/cli/src/build.rs

Lines 25 to 28 in f50fb1c

pub fn build_program(args: &BuildArgs) -> Result<Utf8PathBuf> {
let metadata_cmd = cargo_metadata::MetadataCommand::new();
let metadata = metadata_cmd.exec().unwrap();
let root_package = metadata.root_package();

@varun-doshi
Copy link

Hi...I'd like to work on this issue

@4rgon4ut
Copy link
Contributor

@varun-doshi its been a while so I decided to stab, hope its ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants