mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-10-29 15:02:30 +00:00
Wrap errors with %w when returning them
Many places where we return errors don't use the %w wrapping, because they predate that functionality. This patch changes those to use %w, so callers can inspect the underlying errors with errors.Is and errors.As if needed in the future. The text of the errors does not change, and no existing callers inspect these errors, so there are no behaviour changes.
This commit is contained in:
@@ -187,7 +187,7 @@ func (q *Queue) Put(tr *trace.Trace, from string, to []string, data []byte) (str
|
||||
|
||||
rcpts, err := q.aliases.Resolve(tr, t)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error resolving aliases for %q: %v", t, err)
|
||||
return "", fmt.Errorf("error resolving aliases for %q: %w", t, err)
|
||||
}
|
||||
|
||||
// Add the recipients (after resolving aliases); this conversion is
|
||||
@@ -218,7 +218,7 @@ func (q *Queue) Put(tr *trace.Trace, from string, to []string, data []byte) (str
|
||||
|
||||
err := item.WriteTo(q.path)
|
||||
if err != nil {
|
||||
return "", tr.Errorf("failed to write item: %v", err)
|
||||
return "", tr.Errorf("failed to write item: %w", err)
|
||||
}
|
||||
|
||||
q.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user