From 58db517c8d79c7fd8897d8ab5d5cf9c2de67a071 Mon Sep 17 00:00:00 2001 From: Ray Ganardi Date: Tue, 19 May 2020 13:06:46 +0200 Subject: pgp: fail gracefully from email decryption Aerc panics when there's an error on email decryption. Instead, an error message should be shown. --- commands/account/view.go | 6 +++++- commands/msg/delete.go | 6 +++++- commands/msgview/next.go | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'commands') diff --git a/commands/account/view.go b/commands/account/view.go index d1b90cef..b421666b 100644 --- a/commands/account/view.go +++ b/commands/account/view.go @@ -39,7 +39,11 @@ func (ViewMessage) Execute(aerc *widgets.Aerc, args []string) error { return nil } lib.NewMessageStoreView(msg, store, aerc.DecryptKeys, - func(view lib.MessageView) { + func(view lib.MessageView, err error) { + if err != nil { + aerc.PushError(err.Error()) + return + } viewer := widgets.NewMessageViewer(acct, aerc.Config(), view) aerc.NewTab(viewer, msg.Envelope.Subject) }) diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 313e3ea9..4bda8b98 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -66,7 +66,11 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error { return nil } lib.NewMessageStoreView(next, store, aerc.DecryptKeys, - func(view lib.MessageView) { + func(view lib.MessageView, err error) { + if err != nil { + aerc.PushError(err.Error()) + return + } nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view) aerc.ReplaceTab(mv, nextMv, next.Envelope.Subject) }) diff --git a/commands/msgview/next.go b/commands/msgview/next.go index c218ad53..978cf10f 100644 --- a/commands/msgview/next.go +++ b/commands/msgview/next.go @@ -38,7 +38,11 @@ func (NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error { return nil } lib.NewMessageStoreView(nextMsg, store, aerc.DecryptKeys, - func(view lib.MessageView) { + func(view lib.MessageView, err error) { + if err != nil { + aerc.PushError(err.Error()) + return + } nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view) aerc.ReplaceTab(mv, nextMv, nextMsg.Envelope.Subject) }) -- cgit