mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
0 = all passed, 3 = at least one failure, 4 = no failures but at least 1 warn 1 as a catch all (generic errors), 2 for invalid input/specs etc ref https://github.com/replicatedhq/troubleshoot/issues/1131 docs https://github.com/replicatedhq/troubleshoot.sh/pull/489
36 lines
555 B
Go
36 lines
555 B
Go
package types
|
|
|
|
type NotFoundError struct {
|
|
Name string
|
|
}
|
|
|
|
func (e *NotFoundError) Error() string {
|
|
return e.Name + ": not found"
|
|
}
|
|
|
|
type ExitError interface {
|
|
Error() string
|
|
ExitStatus() int
|
|
}
|
|
|
|
type ExitCodeError struct {
|
|
Msg string
|
|
Code int
|
|
}
|
|
|
|
func (e *ExitCodeError) Error() string {
|
|
return e.Msg
|
|
}
|
|
|
|
func (e *ExitCodeError) ExitStatus() int {
|
|
return e.Code
|
|
}
|
|
|
|
func NewExitCodeError(exitCode int, theErr error) *ExitCodeError {
|
|
useErr := ""
|
|
if theErr != nil {
|
|
useErr = theErr.Error()
|
|
}
|
|
return &ExitCodeError{Msg: useErr, Code: exitCode}
|
|
}
|