diff --git a/artifactory/cli.go b/artifactory/cli.go index db13c4cbf..380e04960 100644 --- a/artifactory/cli.go +++ b/artifactory/cli.go @@ -610,7 +610,7 @@ func createLifecycleDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, e return nil, err } if lcDetails.Url == "" { - return nil, errors.New("platform URL is mandatory for lifecycle commands") + return nil, errors.New("platform URL is mandatory for lifecycle commands. Configure it via the --url flag or by running 'jf config add'") } PlatformToLifecycleUrls(lcDetails) return lcDetails, nil @@ -878,7 +878,7 @@ func usersCreateCmd(c *cli.Context) error { usersCreateCmd := usersmanagement.NewUsersCreateCommand() csvFilePath := c.String("csv") if csvFilePath == "" { - return cliutils.PrintHelpAndReturnError("missing --csv ", c) + return cliutils.PrintHelpAndReturnError("missing --csv . The CSV file must include a header row with the columns: username, password, email", c) } usersList, err := parseCSVToUsersList(csvFilePath) if err != nil { @@ -928,7 +928,7 @@ func usersDeleteCmd(c *cli.Context) error { } if len(usersNamesList) < 1 { - return cliutils.PrintHelpAndReturnError("missing OR --csv ", c) + return cliutils.PrintHelpAndReturnError("missing OR --csv . Example: jf rt udel 'user1,user2' or jf rt udel --csv users.csv", c) } if !cliutils.GetQuietValue(c) && !coreutils.AskYesNo("This command will delete users. Are you sure you want to continue?\n"+ diff --git a/buildtools/cli.go b/buildtools/cli.go index 54d2abe37..eeac2ee02 100644 --- a/buildtools/cli.go +++ b/buildtools/cli.go @@ -651,7 +651,7 @@ func GradleCmd(c *cli.Context) (err error) { return cleanedArgs, nil, err } if serverDetails == nil { - return cleanedArgs, nil, fmt.Errorf("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id") + return cleanedArgs, nil, fmt.Errorf("no default server configuration found. Please configure a server using 'jf config add' or specify a server using --server-id") } return cleanedArgs, serverDetails, nil } @@ -1508,7 +1508,7 @@ func extractHelmServerDetails(args []string) ([]string, *coreConfig.ServerDetail return cleanedArgs, nil, err } if serverDetails == nil { - return cleanedArgs, nil, fmt.Errorf("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id") + return cleanedArgs, nil, fmt.Errorf("no default server configuration found. Please configure a server using 'jf config add' or specify a server using --server-id") } return cleanedArgs, serverDetails, nil } @@ -1695,7 +1695,7 @@ func terraformCmd(c *cli.Context) error { case "publish", "p": return terraformPublishCmd(configFilePath, filteredArgs, c) default: - return errorutils.CheckErrorf("Terraform command: '%s' is not supported. %s", cmdName, cliutils.GetDocumentationMessage()) + return errorutils.CheckErrorf("Terraform command: '%s' is not supported. Supported commands: publish. %s", cmdName, cliutils.GetDocumentationMessage()) } } diff --git a/config/cli.go b/config/cli.go index 1b8f0ca7c..d132ea294 100644 --- a/config/cli.go +++ b/config/cli.go @@ -245,7 +245,7 @@ func ValidateServerId(serverId string) error { reservedIds := []string{"delete", "use", "show", "clear"} for _, reservedId := range reservedIds { if serverId == reservedId { - return fmt.Errorf("server can't have one of the following ID's: %s\n%s", strings.Join(reservedIds, ", "), cliutils.GetDocumentationMessage()) + return fmt.Errorf("'%s' is a reserved name and cannot be used as a server ID. Reserved names: %s", serverId, strings.Join(reservedIds, ", ")) } } return nil @@ -265,7 +265,7 @@ func validateServerExistence(serverId string, operation configOperation) error { func validateConfigFlags(configCommandConfiguration *commands.ConfigCommandConfiguration) error { // Validate the option is not used along with access token if configCommandConfiguration.BasicAuthOnly && configCommandConfiguration.ServerDetails.AccessToken != "" { - return errorutils.CheckErrorf("the --%s option is only supported when username and password/API key are provided", cliutils.BasicAuthOnly) + return errorutils.CheckErrorf("the --%s option is only supported when username and password/access token are provided", cliutils.BasicAuthOnly) } if err := validatePathsExist(configCommandConfiguration.ServerDetails.SshKeyPath, configCommandConfiguration.ServerDetails.ClientCertPath, configCommandConfiguration.ServerDetails.ClientCertKeyPath); err != nil { return err @@ -300,7 +300,7 @@ func validatePathsExist(paths ...string) error { return err } if !exists { - return errorutils.CheckErrorf("file does not exit at %s", path) + return errorutils.CheckErrorf("file does not exist at %s", path) } } } diff --git a/general/summary/cli.go b/general/summary/cli.go index 7f9881d1b..31e86c0fb 100644 --- a/general/summary/cli.go +++ b/general/summary/cli.go @@ -189,7 +189,7 @@ func invokeSectionMarkdownGeneration(section MarkdownSection) error { case Evidence: return generateEvidenceMarkdown() default: - return fmt.Errorf("unknown section: %s", section) + return fmt.Errorf("unknown section: %s. Valid sections: security, build-info, upload, evidence", section) } } diff --git a/pipelines/cli.go b/pipelines/cli.go index 347508672..28eb7217b 100644 --- a/pipelines/cli.go +++ b/pipelines/cli.go @@ -87,7 +87,7 @@ func createPipelinesDetailsByFlags(c *cli.Context) (*coreConfig.ServerDetails, e return nil, err } if plDetails.PipelinesUrl == "" { - return nil, errors.New("no JFrog Pipelines URL specified as part of the server configuration") + return nil, errors.New("no JFrog Pipelines URL specified as part of the server configuration. Run 'jf config edit ' and set the Pipelines URL") } return plDetails, nil } diff --git a/plugins/utils/signatureutils.go b/plugins/utils/signatureutils.go index bd425c8cc..33f26da65 100644 --- a/plugins/utils/signatureutils.go +++ b/plugins/utils/signatureutils.go @@ -68,7 +68,7 @@ func getPluginsSignatures() ([]*components.PluginSignature, error) { } func logSkippablePluginsError(msg, pluginName string, err error) { - log.Error(fmt.Sprintf("%s%s: '%s'. Skiping...", pluginsErrorPrefix, msg, pluginName)) + log.Error(fmt.Sprintf("%s%s: '%s'. Skipping...", pluginsErrorPrefix, msg, pluginName)) if err != nil { log.Error("Error was: " + err.Error()) } diff --git a/utils/buildinfo/buildinfo.go b/utils/buildinfo/buildinfo.go index 4952c9a55..e716a6cd2 100644 --- a/utils/buildinfo/buildinfo.go +++ b/utils/buildinfo/buildinfo.go @@ -446,7 +446,7 @@ func addArtifactsToBuildInfo(buildInfo *buildinfo.BuildInfo, serverDetails *conf log.Debug("Collecting artifacts for build info...") if len(buildInfo.Modules) == 0 { - return fmt.Errorf("no modules found in build info") + return fmt.Errorf("no modules found in build info. Ensure you ran a build command (e.g., jf mvn, jf npm) with --build-name and --build-number before publishing") } // Get the main module (should be the Poetry module) @@ -697,7 +697,7 @@ func inferPoetryConfigFromToml(_ project.ProjectType) (*project.RepositoryConfig sources := viper.Get("tool.poetry.source") if sources == nil { - return nil, fmt.Errorf("no Poetry sources found in pyproject.toml") + return nil, fmt.Errorf("no Poetry sources found in pyproject.toml. Add a source pointing to your JFrog repository. See 'jf poetry-config --help' for details") } // Get list of configured servers from jf config diff --git a/utils/cliutils/utils.go b/utils/cliutils/utils.go index 0cf5a6d89..62a851c8c 100644 --- a/utils/cliutils/utils.go +++ b/utils/cliutils/utils.go @@ -85,7 +85,7 @@ func GetCliError(err error, success, failed int, failNoOp bool) error { return coreutils.CliError{ExitCode: coreutils.ExitCodeError, ErrorMsg: errorMessage} } case coreutils.ExitCodeFailNoOp: - return coreutils.CliError{ExitCode: coreutils.ExitCodeFailNoOp, ErrorMsg: "No errors, but also no files affected (fail-no-op flag)."} + return coreutils.CliError{ExitCode: coreutils.ExitCodeFailNoOp, ErrorMsg: "No files were affected by the operation. To allow this, remove the --fail-no-op flag."} default: return nil } @@ -641,12 +641,12 @@ func getLatestCliVersionFromGithubAPI() (githubVersionInfo githubResponse, err e log.Debug(fmt.Sprintf("Sending HTTP %s request to: %s", req.Method, req.URL)) resp, body, err := doHttpRequest(client, req) if err != nil { - err = errors.New("couldn't get latest JFrog CLI latest version info from GitHub API: " + err.Error()) + err = errors.New("couldn't get the latest JFrog CLI version info from GitHub API: " + err.Error()) return } err = errorutils.CheckResponseStatusWithBody(resp, body, http.StatusOK) if resp.StatusCode == http.StatusForbidden && githubToken == "" { - err = errors.New("received HTTP status Forbidden from Github, there is no GitHub token, please set github token to avoid anonymous calls rate limits: " + string(body)) + err = errors.New("GitHub API rate limit exceeded. Set the JFROG_CLI_GITHUB_TOKEN environment variable to authenticate and avoid rate limits: " + string(body)) return } if err != nil { @@ -660,7 +660,7 @@ func getLatestCliVersionFromGithubAPI() (githubVersionInfo githubResponse, err e } // Validate the received version tag format if !isValidVersionTag(githubVersionInfo.TagName) { - err = errors.New("invalid version tag format received from GitHub API") + err = errors.New("invalid version tag format received from GitHub API. You can suppress this check with JFROG_CLI_AVOID_NEW_VERSION_WARNING=true") } return } @@ -746,7 +746,7 @@ func getDebFlag(c *cli.Context) (deb string, err error) { deb = c.String("deb") slashesCount := strings.Count(deb, "/") - strings.Count(deb, "\\/") if deb != "" && slashesCount != 2 { - return "", errors.New("the --deb option should be in the form of distribution/component/architecture") + return "", errors.New("the --deb option should be in the form of distribution/component/architecture (e.g., bionic/main/amd64)") } return deb, nil }