killercup / killercup/cargo-edit

Bad non-descriptive error message in src/error.rs in invalid_cargo_config function

Open
#933 2 comments 0 reactions 0 assignees View on GitHub
bug cargo-upgrade
Dominant language
Rust
Stars
3.5k
Forks
166
PR merge metrics
No merged PRs in 30d

Description

I'm currently packaging cargo upgrade and bumped into "[Invalid cargo config](https://github.com/killercup/cargo-edit/blob/master/src/errors.rs#L81)" error during running tests. And it created like ton of questions: What is this even supposed to mean? Like what one of multiple [cargo configs](https://doc.rust-lang.org/cargo/reference/config.html) is invalid? What is considered "invalid"? Is it broken symbols? Is it broken paths? What do I do to fix this error?

So, you got the point, this error does not provide the user with almost any useful information to correct the error. It would be better if this error provided the user with information such as "what config", "why is it invalid" and "how to fix it".

Actually, the problem was that I was using .cargo/config.toml for vendoring, which doesn't really match the common build configuration.

Contributor guide

Open the contributing guide

Research direction

Start in src/error.rs at the invalid_cargo_config function and inspect how the current error is constructed. Improve the message so it identifies the invalid cargo configuration, explains why it is invalid, and gives useful guidance for fixing it. Done means users can distinguish the configuration and understand the cause and remedy.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.