aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-07-04 17:27:22 +0200
committerRobin Jarry <robin@jarry.cc>2023-07-17 10:23:52 +0200
commita9fdf417662bd203dbd923126ad6233e965cfc2d (patch)
treeb310a11cdcdfca3b4af2a48d2257c1d01fa5d49c /commands/compose
parent801caf812377a5f818aed1b5677c0d667db6b6df (diff)
downloadaerc-a9fdf417662bd203dbd923126ad6233e965cfc2d.tar.gz
compose: improve error handling
On error, return to the caller instead of logging a warning and trying to continue. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'commands/compose')
-rw-r--r--commands/compose/edit.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/commands/compose/edit.go b/commands/compose/edit.go
index 7a61f77a..6f877346 100644
--- a/commands/compose/edit.go
+++ b/commands/compose/edit.go
@@ -24,8 +24,14 @@ func (Edit) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: edit")
}
- composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
- composer.ShowTerminal()
+ composer, ok := aerc.SelectedTabContent().(*widgets.Composer)
+ if !ok {
+ return errors.New("only valid while composing")
+ }
+ err := composer.ShowTerminal()
+ if err != nil {
+ return err
+ }
composer.FocusTerminal()
return nil
}