| 136 | format := w.EffectiveFormat() |
| 137 | |
| 138 | // An --html run is a person redirecting to a file: the error reads as text on |
| 139 | // stderr, as it does on a terminal, rather than as a JSON envelope. Either way the |
| 140 | // message and hint may have come from the server, so they are sanitized first. |
| 141 | if format == FormatStyled || format == FormatHTML { |
| 142 | msg := "Error: " + terminal.Sanitize(e.Message) |
| 143 | if e.Hint != "" { |
| 144 | msg += "\n" + terminal.Sanitize(e.Hint) |
| 145 | } |
| 146 | fmt.Fprintln(w.opts.Stderr, msg) |
| 147 | return |
| 148 | } |