diff options
Diffstat (limited to 'commands/msg')
-rw-r--r-- | commands/msg/forward.go | 14 | ||||
-rw-r--r-- | commands/msg/invite.go | 11 | ||||
-rw-r--r-- | commands/msg/pipe.go | 13 | ||||
-rw-r--r-- | commands/msg/recall.go | 5 | ||||
-rw-r--r-- | commands/msg/reply.go | 11 |
5 files changed, 42 insertions, 12 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go index cd62417c..ddc27910 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -133,14 +133,20 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error { store.FetchFull([]uint32{msg.Uid}, func(fm *types.FullMessage) { tmpFile, err := os.Create(tmpFileName) if err != nil { - println(err) - // TODO: Do something with the error - addTab() + logging.Warnf("failed to create temporary attachment: %v", err) + _, err = addTab() + if err != nil { + logging.Warnf("failed to add tab: %v", err) + } return } defer tmpFile.Close() - io.Copy(tmpFile, fm.Content.Reader) + _, err = io.Copy(tmpFile, fm.Content.Reader) + if err != nil { + logging.Warnf("failed to write to tmpfile: %w", err) + return + } composer, err := addTab() if err != nil { return diff --git a/commands/msg/invite.go b/commands/msg/invite.go index 936cea74..4e8d01dd 100644 --- a/commands/msg/invite.go +++ b/commands/msg/invite.go @@ -8,6 +8,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/calendar" "git.sr.ht/~rjarry/aerc/lib/format" + "git.sr.ht/~rjarry/aerc/logging" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/widgets" "github.com/emersion/go-message/mail" @@ -153,7 +154,10 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { } composer.SetContents(cr.PlainText) - composer.AppendPart(cr.MimeType, cr.Params, cr.CalendarText) + err = composer.AppendPart(cr.MimeType, cr.Params, cr.CalendarText) + if err != nil { + return fmt.Errorf("failed to write invitation: %w", err) + } composer.FocusTerminal() tab := aerc.NewTab(composer, subject) @@ -180,7 +184,10 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error { aerc.PushError(err.Error()) return } else { - addTab(cr) + err := addTab(cr) + if err != nil { + logging.Warnf("failed to add tab: %v", err) + } } }) return nil diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 176d1f0d..7a2489a2 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -96,7 +96,10 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { defer logging.PanicHandler() defer pipe.Close() - io.Copy(pipe, reader) + _, err := io.Copy(pipe, reader) + if err != nil { + logging.Errorf("failed to send data to pipe: %w", err) + } }() err = ecmd.Run() if err != nil { @@ -224,10 +227,14 @@ func newMessagesReader(messages []*types.FullMessage, useMbox bool) io.Reader { go func() { defer pw.Close() for _, msg := range messages { + var err error if useMbox { - mboxer.Write(pw, msg.Content.Reader, "", time.Now()) + err = mboxer.Write(pw, msg.Content.Reader, "", time.Now()) } else { - io.Copy(pw, msg.Content.Reader) + _, err = io.Copy(pw, msg.Content.Reader) + } + if err != nil { + logging.Warnf("failed to write data: %v", err) } } }() diff --git a/commands/msg/recall.go b/commands/msg/recall.go index f0bafc73..8434b8d8 100644 --- a/commands/msg/recall.go +++ b/commands/msg/recall.go @@ -182,7 +182,10 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { composer.SetEncrypt(md.IsEncrypted) } if md.IsSigned { - composer.SetSign(md.IsSigned) + err = composer.SetSign(md.IsSigned) + if err != nil { + logging.Warnf("failed to set signed state: %v", err) + } } } addTab() diff --git a/commands/msg/reply.go b/commands/msg/reply.go index dd5aa190..8365172e 100644 --- a/commands/msg/reply.go +++ b/commands/msg/reply.go @@ -12,6 +12,7 @@ import ( "git.sr.ht/~rjarry/aerc/lib" "git.sr.ht/~rjarry/aerc/lib/format" + "git.sr.ht/~rjarry/aerc/logging" "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/widgets" "github.com/emersion/go-message/mail" @@ -224,9 +225,15 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error { store.FetchBodyPart(msg.Uid, part, func(reader io.Reader) { buf := new(bytes.Buffer) - buf.ReadFrom(reader) + _, err := buf.ReadFrom(reader) + if err != nil { + logging.Warnf("failed to fetch bodypart: %v", err) + } original.Text = buf.String() - addTab() + err = addTab() + if err != nil { + logging.Warnf("failed to add tab: %v", err) + } }) return nil } else { |