charmbracelet/bubbletea

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

FrontSide opened this issue · 0 comments

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