charmbracelet / charmbracelet/bubbletea

Exit with error message to stderr and non-zero status code

Open
#980 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
44.9k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
As far as I can see there is no (standardised) way to make a controlled exit of the program with an error message and exit code

**Describe the solution you'd like**
Take you http example, for instance. In the case that the server responds with an error HTTP status code, you are currently just printing the error, but the program keeps running and all I can do is exit with "q, ctrl+c".
Really what I would expect as a user is probably to receive an error message (maybe even in a bold red font) to stderr (not stdout) and for the program to stop with a non-0 error code.
Is there a recommended way for doing this at the moment?

**Describe alternatives you've considered**
To achieve the above at the moment, what I'd probably do is, format the message myself to look more like an error and simply exit the program in my View() function with log.Fatalf()

**Additional context**
n/a

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.