MCPcopy Index your code
hub / github.com/cloudfoundry/cli / DisplayError

Method DisplayError

util/ui/ui.go:195–208  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

193// satisfies TranslatableError, otherwise it outputs the original error message
194// to ui.Err. It also outputs "FAILED" in bold red to ui.Out.
195func (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
210func (ui *UI) DisplayFileDeprecationWarning() {
211 ui.terminalLock.Lock()

Callers

nothing calls this directly

Calls 4

modifyColorMethod · 0.95
TranslateTextMethod · 0.95
TranslateMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected