MCPcopy Create free account
hub / github.com/cli/cli / PrintFailure

Function PrintFailure

pkg/cmd/issue/artifact/shared/results.go:73–80  ·  view source on GitHub ↗

PrintFailure prints the line for an artifact the command couldn't act on, with err's reason. In a terminal, it reads "X Failed to : " on stderr. Otherwise it is a piped line on stdout whose status is "failed". The command exits 1 after any failure.

(ios *iostreams.IOStreams, r Result, action string, err error)

Source from the content-addressed store, hash-verified

71// on stderr. Otherwise it is a piped line on stdout whose status is "failed".
72// The command exits 1 after any failure.
73func PrintFailure(ios *iostreams.IOStreams, r Result, action string, err error) {
74 reason := FailureReason(err)
75 if !ios.IsStdoutTTY() {
76 printResultLine(ios.Out, "failed", r, reason)
77 return
78 }
79 fmt.Fprintf(ios.ErrOut, "%s Failed to %s: %s\n", ios.ColorScheme().FailureIcon(), action, reason)
80}
81
82// PrintPartialFailure prints the line for an artifact the command acted on
83// while another part of its work failed, such as an artifact saved with only

Callers 7

printFailureFunction · 0.92
createRunFunction · 0.92
downloadRunFunction · 0.92
downloadArtifactFunction · 0.92
editRunFunction · 0.92
restoreVersionFunction · 0.92
TestPrintFailureFunction · 0.85

Calls 5

FailureReasonFunction · 0.85
printResultLineFunction · 0.85
IsStdoutTTYMethod · 0.80
FailureIconMethod · 0.80
ColorSchemeMethod · 0.80

Tested by 1

TestPrintFailureFunction · 0.68