Skip to content

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

Open
@FrontSide

Description

@FrontSide

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions