summaryrefslogtreecommitdiffstats
path: root/pkg/gui/errors.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-03 19:35:37 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commite6274c0757ec7533d2f76a0a1e5f9f53ea62ba96 (patch)
tree459610cdf4c74cc4f9d1055ffef9adfbee5c7c2d /pkg/gui/errors.go
parent0898a7bb57bc399ff016cea06a0ca35d0bf54d6b (diff)
remove sentinel errors
Diffstat (limited to 'pkg/gui/errors.go')
-rw-r--r--pkg/gui/errors.go30
1 files changed, 0 insertions, 30 deletions
diff --git a/pkg/gui/errors.go b/pkg/gui/errors.go
index c275fcdcc..108e4426f 100644
--- a/pkg/gui/errors.go
+++ b/pkg/gui/errors.go
@@ -1,33 +1,3 @@
package gui
-import "github.com/go-errors/errors"
-
-// SentinelErrors are the errors that have special meaning and need to be checked
-// by calling functions. The less of these, the better
-type SentinelErrors struct {
- ErrNoFiles error
-}
-
const UNKNOWN_VIEW_ERROR_MSG = "unknown view"
-
-// GenerateSentinelErrors makes the sentinel errors for the gui. We're defining it here
-// because we can't do package-scoped errors with localization, and also because
-// it seems like package-scoped variables are bad in general
-// https://dave.cheney.net/2017/06/11/go-without-package-scoped-variables
-// In the future it would be good to implement some of the recommendations of
-// that article. For now, if we don't need an error to be a sentinel, we will just
-// define it inline. This has implications for error messages that pop up everywhere
-// in that we'll be duplicating the default values. We may need to look at
-// having a default localisation bundle defined, and just using keys-only when
-// localising things in the code.
-func (gui *Gui) GenerateSentinelErrors() {
- gui.Errors = SentinelErrors{
- ErrNoFiles: errors.New(gui.Tr.NoChangedFiles),
- }
-}
-
-func (gui *Gui) sentinelErrorsArr() []error {
- return []error{
- gui.Errors.ErrNoFiles,
- }
-}