Rework error messages

This commit reworks error messages for all commands and makes sure they
pass liniting.
This commit is contained in:
Tom Wiesing 2023-03-09 11:13:19 +01:00
parent d22784e6f5
commit c31c46ee44
No known key found for this signature in database
40 changed files with 249 additions and 110 deletions

View file

@ -3,6 +3,7 @@ package cmd
import (
wisski_distillery "github.com/FAU-CDI/wisski-distillery"
"github.com/FAU-CDI/wisski-distillery/internal/cli"
"github.com/tkw1536/goprogram/exit"
)
// Ls is the 'ls' command
@ -24,10 +25,15 @@ func (ls) Description() wisski_distillery.Description {
}
}
var errLsWissKI = exit.Error{
Message: "unable to get WissKIs",
ExitCode: exit.ExitGeneric,
}
func (l ls) Run(context wisski_distillery.Context) error {
instances, err := context.Environment.Instances().Load(context.Context, l.Positionals.Slug...)
if err != nil {
return err
return errLsWissKI.Wrap(err)
}
for _, instance := range instances {