MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / printError

Function printError

internal/cli/cli_helpers.go:269–274  ·  view source on GitHub ↗

printError writes a JSON error object to stderr and returns err unchanged so callers can `return printError(err)`.

(err error)

Source from the content-addressed store, hash-verified

267// printError writes a JSON error object to stderr and returns err unchanged so
268// callers can `return printError(err)`.
269func printError(err error) error {
270 data, _ := json.Marshal(map[string]string{"error": err.Error()})
271 fmt.Fprintln(os.Stderr, string(data))
272
273 return err
274}
275
276// printTable writes aligned tabular output to stdout.
277func printTable(headers []string, rows [][]string) {

Callers 15

runStorageListFunction · 0.85
runStorageShowFunction · 0.85
runStorageContentListFunction · 0.85
runStorageContentDeleteFunction · 0.85
runStorageDownloadURLFunction · 0.85
runStorageDownloadOCIFunction · 0.85
runStorageRestoreFunction · 0.85
TestPrintErrorFunction · 0.85
runNodesListFunction · 0.85
runNodesShowFunction · 0.85
runNodesShellFunction · 0.85

Calls 1

ErrorMethod · 0.65

Tested by 1

TestPrintErrorFunction · 0.68