MCPcopy Create free account
hub / github.com/jetify-com/devbox / postRun

Method postRun

internal/boxcli/midcobra/debug.go:51–71  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, runErr error)

Source from the content-addressed store, hash-verified

49}
50
51func (d *DebugMiddleware) postRun(cmd *cobra.Command, args []string, runErr error) {
52 if runErr == nil {
53 return
54 }
55 if userErr, hasUserErr := usererr.Extract(runErr); hasUserErr {
56 if usererr.IsWarning(userErr) {
57 ux.Fwarning(cmd.ErrOrStderr(), runErr.Error())
58 return
59 }
60 color.New(color.FgRed).Fprintf(cmd.ErrOrStderr(), "\nError: %s\n\n", userErr.Error())
61 } else {
62 color.New(color.FgRed).Fprintf(cmd.ErrOrStderr(), "Error: %v\n\n", runErr)
63 }
64
65 st := debug.EarliestStackTrace(runErr)
66 var exitErr *exec.ExitError
67 if errors.As(runErr, &exitErr) {
68 slog.Error("command error", "stderr", exitErr.Stderr, "execid", telemetry.ExecutionID, "stack", st)
69 }
70 slog.Error("command error", "execid", telemetry.ExecutionID, "stack", st)
71}

Callers

nothing calls this directly

Calls 5

ExtractFunction · 0.92
IsWarningFunction · 0.92
FwarningFunction · 0.92
EarliestStackTraceFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected