Skip to content

Better global error handling #3491

@stefanhaller

Description

@stefanhaller

Right now, all entry points into the codebase (e.g. event handlers) need to catch errors and present them in an error panel, so we have tons of calls to self.c.Error(err) in the controller and helper classes. It's easy to forget this, however, and simply return the error instead, which will cause a panic in gocui (see #3490 for an example).

It would be much nicer if we could simply return errors everywhere, and gocui would take care of showing an error box after handling an event that returned an error. To do this gocui.Gui just needs an error callback, this seems very easy (see also the last paragraph of this long comment, starting with "As for surfacing the error..."). It seems we could then hopefully get rid of IPopupHandler.Error.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions