Skip to content

Commit

Permalink
Fixed the error messages (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
satr authored Oct 12, 2023
1 parent 4566420 commit 50b83a2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/setEnvironmentSecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ package cmd

import (
"errors"
"fmt"
"os"

apiclient "github.com/equinor/radix-cli/generated-client/client"
"github.com/equinor/radix-cli/generated-client/client/environment"
Expand Down Expand Up @@ -66,6 +68,10 @@ var setEnvironmentSecretCmd = &cobra.Command{
}

component, _ := cmd.Flags().GetString(componentOption)
if component == "" {
return errors.New("`component` is required")
}

awaitReconcile, _ := cmd.Flags().GetBool(awaitReconcileOption)

cmd.SilenceUsage = true
Expand All @@ -81,7 +87,8 @@ var setEnvironmentSecretCmd = &cobra.Command{
})

if !reconciledOk {
return errors.New("component was not reconciled within time")
return fmt.Errorf("component was not reconciled within time: either component %s does not exist in the environment %s or the component has not secret %s",
component, environmentName, secretName)
}
}

Expand All @@ -107,6 +114,7 @@ func isComponentSecretReconciled(apiClient *apiclient.Radixapi, appName, environ

env, err := apiClient.Environment.GetEnvironment(getEnvironmentParameters, nil)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return false
}

Expand Down

0 comments on commit 50b83a2

Please sign in to comment.