DisplayError outputs the translated error message to ui.Err if the error satisfies TranslatableError, otherwise it outputs the original error message to ui.Err. It also outputs "FAILED" in bold red to ui.Out.
(err error)
| 193 | // satisfies TranslatableError, otherwise it outputs the original error message |
| 194 | // to ui.Err. It also outputs "FAILED" in bold red to ui.Out. |
| 195 | func (ui *UI) DisplayError(err error) { |
| 196 | var errMsg string |
| 197 | if translatableError, ok := err.(translatableerror.TranslatableError); ok { |
| 198 | errMsg = translatableError.Translate(ui.translate) |
| 199 | } else { |
| 200 | errMsg = err.Error() |
| 201 | } |
| 202 | fmt.Fprintf(ui.Err, "%s\n", errMsg) |
| 203 | |
| 204 | ui.terminalLock.Lock() |
| 205 | defer ui.terminalLock.Unlock() |
| 206 | |
| 207 | fmt.Fprintf(ui.Out, "%s\n", ui.modifyColor(ui.TranslateText("FAILED"), color.New(color.FgRed, color.Bold))) |
| 208 | } |
| 209 | |
| 210 | func (ui *UI) DisplayFileDeprecationWarning() { |
| 211 | ui.terminalLock.Lock() |
nothing calls this directly
no test coverage detected