Get rid of the aerc.PushError(" " + $string) idiom

The individual callers should not be responsible for padding
This commit is contained in:
Reto Brunner 2021-01-30 13:51:32 +01:00
parent 949781fa0a
commit 8ea86cea41
18 changed files with 29 additions and 29 deletions

View file

@ -86,7 +86,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
case *types.Done:
wg.Done()
case *types.Error:
aerc.PushError(" " + msg.Error.Error())
aerc.PushError(msg.Error.Error())
success = false
wg.Done()
}

View file

@ -60,7 +60,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error {
case *types.Done:
aerc.PushStatus("Messages copied.", 10*time.Second)
case *types.Error:
aerc.PushError(" " + msg.Error.Error())
aerc.PushError(msg.Error.Error())
}
})
return nil

View file

@ -47,7 +47,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
case *types.Done:
aerc.PushStatus("Messages deleted.", 10*time.Second)
case *types.Error:
aerc.PushError(" " + msg.Error.Error())
aerc.PushError(msg.Error.Error())
case *types.Unsupported:
// notmuch doesn't support it, we want the user to know
aerc.PushError(" error, unsupported for this worker")

View file

@ -58,7 +58,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
case *types.Done:
aerc.PushStatus("labels updated", 10*time.Second)
case *types.Error:
aerc.PushError(" " + msg.Error.Error())
aerc.PushError(msg.Error.Error())
}
})
return nil

View file

@ -71,7 +71,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
case *types.Done:
aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
case *types.Error:
aerc.PushError(" " + msg.Error.Error())
aerc.PushError(msg.Error.Error())
}
})
return nil

View file

@ -75,7 +75,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
doTerm := func(reader io.Reader, name string) {
term, err := commands.QuickTerm(aerc, cmd, reader)
if err != nil {
aerc.PushError(" " + err.Error())
aerc.PushError(err.Error())
return
}
aerc.NewTab(term, name)
@ -93,7 +93,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
}()
err = ecmd.Run()
if err != nil {
aerc.PushError(" " + err.Error())
aerc.PushError(err.Error())
} else {
if ecmd.ProcessState.ExitCode() != 0 {
aerc.PushError(fmt.Sprintf(

View file

@ -187,7 +187,7 @@ func submitFlagChange(aerc *widgets.Aerc, store *lib.MessageStore,
case *types.Done:
wg.Done()
case *types.Error:
aerc.PushError(" " + msg.Error.Error())
aerc.PushError(msg.Error.Error())
*success = false
wg.Done()
}

View file

@ -86,7 +86,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
}, func(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Error:
aerc.PushError(" " + msg.Error.Error())
aerc.PushError(msg.Error.Error())
composer.Close()
}
})