0
0
mirror of https://github.com/thegeeklab/wp-ansible.git synced 2024-11-25 09:00:39 +00:00

fix: fix error handling (#131)

This commit is contained in:
Robert Kaussow 2023-02-20 22:08:16 +01:00 committed by GitHub
parent 673a2af11c
commit 6dec97cc69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,11 +53,21 @@ func run(settings *plugin.Settings) cli.ActionFunc {
) )
if err := plugin.Validate(); err != nil { 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 { 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 return nil