akiomik / akiomik/nostui

Every failing exit leads with a line that says nothing

Open
#577 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
71
Forks
5
Avg merge
4h 2m
Merged PRs (30d)
31

Description

Noticed while reviewing [#576](https://github.com/akiomik/nostui/pull/576), which makes the message underneath it worth reading. Pre-existing, and about every error rather than that one.

## What happens

```
nostui error: Something went wrong
Error:
0: No configuration file found in /Users/…/Library/Application Support/io.0m1.nostui

```

The first line is `src/main.rs`:

```rust
if let Err(e) = tokio_main().await {
eprintln!("{} error: Something went wrong", env!("CARGO_PKG_NAME"));
Err(e)
}
```

It is not `human_panic`, which only runs from the panic hook in `src/utils/panic.rs` and is never reached here — worth saying because that is where someone would look for it.

The line above tells the reader that something went wrong; the line below tells them what. The first one is spent before the second is read, and on a fresh install — the case #113 is about — those four lines are the entire product.

## Both sides of it

What it does carry is the program's name, which is the only thing identifying the output as nostui's when stderr is mixed with something else's. That is not nothing, and it is the reason this is a question rather than a deletion.

If the name is worth keeping, `color_eyre` can carry it: a section, or a panic-section hook, puts it on a line that also says something. If it is not, the `eprintln!` goes and `main` returns the error.

Either way the answer applies to every failing exit, which is why it did not travel with #576.

## Acceptance

- A failure prints no line that could be dropped without losing information.
- Whatever identifies the output as nostui's, if anything still needs to, survives.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.