aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap
diff options
context:
space:
mode:
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/configure.go18
-rw-r--r--worker/imap/fetch.go4
-rw-r--r--worker/imap/worker.go2
3 files changed, 12 insertions, 12 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
}
diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go
index 41269cbf..f21c6e91 100644
--- a/worker/imap/fetch.go
+++ b/worker/imap/fetch.go
@@ -118,13 +118,13 @@ func (imapw *IMAPWorker) handleFetchMessageBodyPart(
}
h, err := textproto.ReadHeader(bufio.NewReader(body))
if err != nil {
- return fmt.Errorf("failed to read part header: %v", err)
+ return fmt.Errorf("failed to read part header: %w", err)
}
part, err := message.New(message.Header{Header: h},
_msg.GetBody(&partBodySection))
if err != nil {
- return fmt.Errorf("failed to create message reader: %v", err)
+ return fmt.Errorf("failed to create message reader: %w", err)
}
imapw.worker.PostMessage(&types.MessageBodyPart{
diff --git a/worker/imap/worker.go b/worker/imap/worker.go
index 40debe64..6b6c9261 100644
--- a/worker/imap/worker.go
+++ b/worker/imap/worker.go
@@ -282,7 +282,7 @@ func (w *IMAPWorker) Run() {
case msg := <-w.worker.Actions:
msg = w.worker.ProcessAction(msg)
- if err := w.handleMessage(msg); err == errUnsupported {
+ if err := w.handleMessage(msg); errors.Is(err, errUnsupported) {
w.worker.PostMessage(&types.Unsupported{
Message: types.RespondTo(msg),
}, nil)