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)
| 342 | // This is the main way that shell errors are handled. |
| 343 | // It also prints the error. |
| 344 | func (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. |
no test coverage detected