Skip to content

Dealing with errors #54

@secona

Description

@secona

#[cargo_test]
fn errors_when_no_manifest() {
let p = project().no_manifest().build();
p.cargo_plumbing("plumbing locate-manifest")
.with_stderr_data(str![[r#"
[ERROR] could not find `Cargo.toml` in `[ROOT]/foo` or any parent directory
"#]])
.with_stdout_data("")
.with_status(101)
.run();
}

Currently, we have one test for errors and that error is in a form of plain strings outputted to stderr. In the future, should we keep doing this or should we opt in for an all jsonlines option? Perhaps something like this.

{
  "reason": "locate-manifest-error",
  "msg": "could not find `Cargo.toml` in `[ROOT]/foo` or any parent directory"
}

I don't think outputting to stderr is a problem, its just that we currently don't have a way for users to understand errors programmatically.

I remember we had a conversation about handling errors in cargo-plumbing-schemas, though I don't remember where exactly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions