ShouldLogError returns true if the it's a combined error specifically marked to be logged or if it's not an ExitError.
(err error)
| 86 | // ShouldLogError returns true if the it's a combined error specifically marked to be logged |
| 87 | // or if it's not an ExitError. |
| 88 | func ShouldLogError(err error) bool { |
| 89 | if err == nil { |
| 90 | return false |
| 91 | } |
| 92 | var userExecErr *ExitError |
| 93 | if errors.As(err, &userExecErr) { |
| 94 | return false |
| 95 | } |
| 96 | c := &combined{} |
| 97 | if errors.As(err, &c) { |
| 98 | return c.logged |
| 99 | } |
| 100 | return true |
| 101 | } |
| 102 | |
| 103 | func IsWarning(err error) bool { |
| 104 | c := &combined{} |