From c0672200154d2442b11e3a47dbec943826784caa Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Mon, 1 Feb 2021 16:28:10 +0100 Subject: [PATCH] Link to troubleshooting docs when src campaign apply|preview fails This fixes https://github.com/sourcegraph/sourcegraph/issues/17259, but contrary to what I stated in the original ticket, I think it makes more sense to always link to these docs. Why? 1. It's two lines. It doesn't hurt. 2. It's really tricky to find out exactly when to link to the docs and when not. Especially since running the steps could result in an error that could be fixed through the troubleshooting guide (example: broken docker setup). --- cmd/src/campaigns_common.go | 2 ++ internal/output/emoji.go | 7 ++++--- internal/output/style.go | 11 ++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmd/src/campaigns_common.go b/cmd/src/campaigns_common.go index 2064946ffc..ce234c0710 100644 --- a/cmd/src/campaigns_common.go +++ b/cmd/src/campaigns_common.go @@ -380,6 +380,8 @@ func printExecutionError(out *output.Output, err error) { writeErrs([]error{err}) } + out.Write("") + out.WriteLine(output.Line(output.EmojiLightbulb, output.StyleSuggestion, "The troubleshooting documentation can help to narrow down the cause of the errors: https://docs.sourcegraph.com/campaigns/references/troubleshooting")) } func flattenErrs(err error) (result []error) { diff --git a/internal/output/emoji.go b/internal/output/emoji.go index a046591496..56a38d4257 100644 --- a/internal/output/emoji.go +++ b/internal/output/emoji.go @@ -2,7 +2,8 @@ package output // Standard emoji for use in output. const ( - EmojiFailure = "❌" - EmojiWarning = "❗️" - EmojiSuccess = "✅" + EmojiFailure = "❌" + EmojiWarning = "❗️" + EmojiSuccess = "✅" + EmojiLightbulb = "💡" ) diff --git a/internal/output/style.go b/internal/output/style.go index bd90a94120..f43bd75109 100644 --- a/internal/output/style.go +++ b/internal/output/style.go @@ -25,11 +25,12 @@ type style struct{ code string } func (s *style) String() string { return s.code } var ( - StyleReset = &style{"\033[0m"} - StyleLogo = Fg256Color(57) - StylePending = Fg256Color(4) - StyleWarning = Fg256Color(124) - StyleSuccess = Fg256Color(2) + StyleReset = &style{"\033[0m"} + StyleLogo = Fg256Color(57) + StylePending = Fg256Color(4) + StyleWarning = Fg256Color(124) + StyleSuccess = Fg256Color(2) + StyleSuggestion = Fg256Color(244) StyleBold = &style{"\033[1m"} StyleItalic = &style{"\033[3m"}