MCPcopy Create free account
hub / github.com/cogentcore/core / AddError

Method AddError

shell/shell.go:344–352  ·  view source on GitHub ↗

AddError adds the given error to the error stack if it is non-nil, and calls the Cancel function if set, to stop execution. This is the main way that shell errors are handled. It also prints the error.

(err error)

Source from the content-addressed store, hash-verified

342// This is the main way that shell errors are handled.
343// It also prints the error.
344func (sh *Shell) AddError(err error) error {
345 if err == nil {
346 return nil
347 }
348 sh.Errors = append(sh.Errors, err)
349 logx.PrintlnError(err)
350 sh.CancelExecution()
351 return err
352}
353
354// TranspileConfig transpiles the .cosh startup config file in the user's
355// home directory if it exists.

Callers 8

TranspileLineTokensMethod · 0.95
TranspileExecStringMethod · 0.95
TranspileExecMethod · 0.95
ExecMethod · 0.95
RunBuiltinOrCommandMethod · 0.95
HandleArgErrMethod · 0.95
JobIDExpandMethod · 0.95
RunCodeMethod · 0.45

Calls 2

CancelExecutionMethod · 0.95
PrintlnErrorFunction · 0.92

Tested by

no test coverage detected