Skip to content

Commit

Permalink
errors: allow to specify icon
Browse files Browse the repository at this point in the history
  • Loading branch information
brmzkw committed Jul 31, 2024
1 parent 59efb32 commit b82b84e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/koyeb/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type CLIError struct {
Orig error // Original error
Solution CLIErrorSolution // How to solve the error. For example: "update the CLI"
ASCII bool // Whether to use only ASCII characters in the error message
Icon string // Icon to display in the error message for non-ASCII output
}

func (e *CLIError) Error() string {
Expand All @@ -42,7 +43,10 @@ func (e *CLIError) Error() string {
{{- end}}
`
} else {
tmplError = `❌ {{.What}}: {{.Why}}
if e.Icon == "" {
e.Icon = "❌"
}
tmplError = `{{.Icon}} {{.What}}: {{.Why}}
{{if .Additional}}
🔎 Additional details
{{range .Additional}}{{.}}
Expand Down

0 comments on commit b82b84e

Please sign in to comment.