Files
troubleshoot/pkg/types/types.go
Archit Sharma 7038da85b1 Velero analyzer (#1366)
* feat: add velero analyzer (#806)

  * updated schema
  * analyzer without collector
  * tests
  * covers deprecated Restic repository type
  * velero version from deployment image to check deprecated type
  * read for both velero pod kinds (velero*, node-agent*)

---------

Signed-off-by: Archit Sharma <archit@pm.me>
2023-11-03 18:41:17 +05:30

52 lines
814 B
Go

package types
import (
"fmt"
)
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
}
type ExitCodeWarning struct {
Msg string
}
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}
}
func NewExitCodeWarning(theErrMsg string) *ExitCodeWarning {
return &ExitCodeWarning{Msg: theErrMsg}
}
func (e *ExitCodeWarning) Warning() string {
return fmt.Sprintf("Warning: %s", e.Msg)
}