From b18bcee533e2c6c7e9f679bc4046043f00137bcb Mon Sep 17 00:00:00 2001 From: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com> Date: Wed, 19 Aug 2020 20:20:00 +0200 Subject: [PATCH] artifactPrepareVersion: improve error categorization (#1936) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * artifactPrepareVersion: improve error categorization * Update getConfig.go Co-authored-by: Stephan Aßmus --- cmd/artifactPrepareVersion.go | 4 ++++ cmd/getConfig.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/artifactPrepareVersion.go b/cmd/artifactPrepareVersion.go index 18d8e00bc..6a0691ab4 100644 --- a/cmd/artifactPrepareVersion.go +++ b/cmd/artifactPrepareVersion.go @@ -336,6 +336,10 @@ func pushChanges(config *artifactPrepareVersionOptions, newVersion string, repos log.SetErrorCategory(log.ErrorConfiguration) case strings.Contains(errText, "Permission"): log.SetErrorCategory(log.ErrorConfiguration) + case strings.Contains(errText, "authorization failed"): + log.SetErrorCategory(log.ErrorConfiguration) + case strings.Contains(errText, "authentication required"): + log.SetErrorCategory(log.ErrorConfiguration) case strings.Contains(errText, "knownhosts: illegal base64"): err = errors.Wrap(err, "known_hosts file seems invalid") log.SetErrorCategory(log.ErrorConfiguration) diff --git a/cmd/getConfig.go b/cmd/getConfig.go index b4e4fa650..19d464c77 100644 --- a/cmd/getConfig.go +++ b/cmd/getConfig.go @@ -38,7 +38,8 @@ func ConfigCommand() *cobra.Command { Run: func(cmd *cobra.Command, _ []string) { err := generateConfig() if err != nil { - log.Entry().WithField("category", "config").WithError(err).Fatal("failed to retrieve configuration") + log.SetErrorCategory(log.ErrorConfiguration) + log.Entry().WithError(err).Fatal("failed to retrieve configuration") } }, }