diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-04-18 10:14:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 10:14:51 +0200 |
commit | 34f8f7293c5c901461a26f09839ebe5f0dd79869 (patch) | |
tree | 4b65b46c7d1e32f1d8e90b528545b081b0fd8822 /pkg/gui/controllers/helpers/confirmation_helper.go | |
parent | 145795c0b07da129599506ac8827a16314456ac4 (diff) | |
parent | caad55350252793b53aaf699062644a2cddc6a08 (diff) |
Simplify error handling (#3502)
- **PR Description**
Simplify and canonicalize error handling across the code base.
Previously it was important to make sure that errors don't bubble up
into gocui, because it would panic there; so we had to show errors in
error panels in the right places (in controller code, usually). This is
error-prone because it's easy to forget (see #3490 for an example);
also, it's not always obvious where in the call chain the error panel
needs to be shown. Most of the time it's in controller code, but we had
plenty of calls to `Error()` in helpers, and I remember that I found
this very confusing when I was new to the code base.
Change this so that you can simply return errors everywhere. The
functions to show an error message manually have been removed for
clarity.
I tried to structure the commits so that you can review them one by one.
Closes #3491.
Diffstat (limited to 'pkg/gui/controllers/helpers/confirmation_helper.go')
-rw-r--r-- | pkg/gui/controllers/helpers/confirmation_helper.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index 6cf5a1e90..8c1265c15 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -36,7 +36,7 @@ func (self *ConfirmationHelper) wrappedConfirmationFunction(cancel goContext.Can if function != nil { if err := function(); err != nil { - return self.c.Error(err) + return err } } |