Rework error messages
This commit reworks error messages for all commands and makes sure they pass liniting.
This commit is contained in:
parent
d22784e6f5
commit
c31c46ee44
40 changed files with 249 additions and 110 deletions
|
|
@ -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"
|
||||
)
|
||||
|
||||
// Config is the configuration command
|
||||
|
|
@ -20,6 +21,14 @@ func (c cfg) Description() wisski_distillery.Description {
|
|||
}
|
||||
}
|
||||
|
||||
func (cfg) Run(context wisski_distillery.Context) error {
|
||||
return context.Environment.Config.Marshal(context.Stdout)
|
||||
var errMarshalConfig = exit.Error{
|
||||
Message: "unable to marshal config",
|
||||
ExitCode: exit.ExitGeneric,
|
||||
}
|
||||
|
||||
func (cfg) Run(context wisski_distillery.Context) error {
|
||||
if err := context.Environment.Config.Marshal(context.Stdout); err != nil {
|
||||
return errMarshalConfig.Wrap(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue