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)
| 71 | // on stderr. Otherwise it is a piped line on stdout whose status is "failed". |
| 72 | // The command exits 1 after any failure. |
| 73 | func 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 |