MCPcopy
hub / github.com/garethgeorge/backrest / newCmdError

Function newCmdError

pkg/restic/error.go:31–42  ·  view source on GitHub ↗

newCmdError creates a new error indicating that running a command failed.

(cmd *exec.Cmd, err error)

Source from the content-addressed store, hash-verified

29
30// newCmdError creates a new error indicating that running a command failed.
31func newCmdError(cmd *exec.Cmd, err error) *CmdError {
32 shortCmd := cmd.String()
33 if len(shortCmd) > 100 {
34 shortCmd = shortCmd[:100] + "..."
35 }
36
37 cerr := &CmdError{
38 Command: shortCmd,
39 Err: err,
40 }
41 return cerr
42}
43
44type ErrorWithOutput struct {
45 Err error

Callers 2

runCommandWithProgressFunction · 0.85
AddCmdOutputToErrorMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected