mirror of
https://github.com/thegeeklab/wp-ansible.git
synced 2024-11-21 13:40:39 +00:00
fix: fix error handling (#131)
This commit is contained in:
parent
673a2af11c
commit
6dec97cc69
@ -53,11 +53,21 @@ func run(settings *plugin.Settings) cli.ActionFunc {
|
||||
)
|
||||
|
||||
if err := plugin.Validate(); err != nil {
|
||||
return fmt.Errorf("validation failed: %w", err)
|
||||
//nolint:errorlint
|
||||
if e, ok := err.(errors.ExitCoder); ok {
|
||||
return e
|
||||
}
|
||||
|
||||
return errors.ExitMessagef("validation failed: %w", err)
|
||||
}
|
||||
|
||||
if err := plugin.Execute(); err != nil {
|
||||
return fmt.Errorf("execution failed: %w", err)
|
||||
//nolint:errorlint
|
||||
if e, ok := err.(errors.ExitCoder); ok {
|
||||
return e
|
||||
}
|
||||
|
||||
return errors.ExitMessagef("execution failed: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user