diff options
author | Moritz Poldrack <git@moritz.sh> | 2022-07-31 15:15:27 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-04 21:58:04 +0200 |
commit | 70bfcfef42578079f211d87cddc49519ee3503dc (patch) | |
tree | ae35c38e3980c73af2b43be10fe8cc9ece4f3f9a /worker/imap/configure.go | |
parent | 978d35d356e8752bdd272884df48a6289d88b40a (diff) | |
download | aerc-70bfcfef42578079f211d87cddc49519ee3503dc.tar.gz |
lint: work nicely with wrapped errors (errorlint)
Error wrapping as introduced in Go 1.13 adds some additional logic to
use for comparing errors and adding information to it.
Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/imap/configure.go')
-rw-r--r-- | worker/imap/configure.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/worker/imap/configure.go b/worker/imap/configure.go index f5151880..691e0d76 100644 --- a/worker/imap/configure.go +++ b/worker/imap/configure.go @@ -65,7 +65,7 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { val, err := time.ParseDuration(value) if err != nil || val < 0 { return fmt.Errorf( - "invalid idle-timeout value %v: %v", + "invalid idle-timeout value %v: %w", value, err) } w.config.idle_timeout = val @@ -73,7 +73,7 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { val, err := time.ParseDuration(value) if err != nil || val < 0 { return fmt.Errorf( - "invalid idle-debounce value %v: %v", + "invalid idle-debounce value %v: %w", value, err) } w.config.idle_debounce = val @@ -81,7 +81,7 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { val, err := time.ParseDuration(value) if err != nil || val < 0 { return fmt.Errorf( - "invalid reconnect-maxwait value %v: %v", + "invalid reconnect-maxwait value %v: %w", value, err) } w.config.reconnect_maxwait = val @@ -89,7 +89,7 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { val, err := time.ParseDuration(value) if err != nil || val < 0 { return fmt.Errorf( - "invalid connection-timeout value %v: %v", + "invalid connection-timeout value %v: %w", value, err) } w.config.connection_timeout = val @@ -97,7 +97,7 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { val, err := time.ParseDuration(value) if err != nil || val < 0 { return fmt.Errorf( - "invalid keepalive-period value %v: %v", + "invalid keepalive-period value %v: %w", value, err) } w.config.keepalive_period = val @@ -105,7 +105,7 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { val, err := strconv.Atoi(value) if err != nil || val < 0 { return fmt.Errorf( - "invalid keepalive-probes value %v: %v", + "invalid keepalive-probes value %v: %w", value, err) } w.config.keepalive_probes = val @@ -113,7 +113,7 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { val, err := time.ParseDuration(value) if err != nil || val < 0 { return fmt.Errorf( - "invalid keepalive-interval value %v: %v", + "invalid keepalive-interval value %v: %w", value, err) } w.config.keepalive_interval = int(val.Seconds()) @@ -123,13 +123,13 @@ func (w *IMAPWorker) handleConfigure(msg *types.Configure) error { // Return an error here because the user tried to set header // caching, and we want them to know they didn't set it right - // one way or the other - return fmt.Errorf("invalid cache-headers value %v: %v", value, err) + return fmt.Errorf("invalid cache-headers value %v: %w", value, err) } w.config.cacheEnabled = cache case "cache-max-age": val, err := time.ParseDuration(value) if err != nil || val < 0 { - return fmt.Errorf("invalid cache-max-age value %v: %v", value, err) + return fmt.Errorf("invalid cache-max-age value %v: %w", value, err) } w.config.cacheMaxAge = val } |