From a9fdf417662bd203dbd923126ad6233e965cfc2d Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Tue, 4 Jul 2023 17:27:22 +0200 Subject: compose: improve error handling On error, return to the caller instead of logging a warning and trying to continue. Signed-off-by: Robin Jarry Tested-by: Bence Ferdinandy Tested-by: Koni Marti --- commands/compose/edit.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'commands/compose') 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 } -- cgit