Documentation
¶
Index ¶
- func AsCustomError(err error) (CustomError, CustomError)
- func Equals(a, b error) bool
- func FormatJsonError(err error) string
- func HasErrors(errs ...error) bool
- func HasWarnings(errs ...error) bool
- func IsCustomError(err error) bool
- func IsError(err error) bool
- func IsWarning(err error) bool
- type CustomError
- type Error
- type ErrorList
- type JsonErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsCustomError ¶
func AsCustomError(err error) (CustomError, CustomError)
AsCustomError casts the given error to an CustomError
func FormatJsonError ¶
FormatJsonError returns a JSON formatted string representation of the given error
func HasWarnings ¶
HasWarnings checks if the given errors contain any warnings
func IsCustomError ¶
IsCustomError checks if the given error is an CustomError
Types ¶
type CustomError ¶
type CustomError interface {
error
GetExitCode() int
GetMessage() string
GetStack() string
AsWarning() CustomError
AsError() CustomError
WithIcon(icon string) CustomError
}
CustomError is a custom error type that can be an Error or a Warning based on the ExitCode
func Combine ¶
func Combine(errs ...error) CustomError
Combine combines multiple CustomError into one CustomError
func Wrap ¶
func Wrap(err error, additional ...string) CustomError
Wrap wraps the given error with additional information
type Error ¶
Error is a custom error type that can be an Error or a Warning based on the ExitCode
func (*Error) AsError ¶
func (e *Error) AsError() CustomError
AsError changes the exit code of the Error to -1
func (*Error) AsWarning ¶
func (e *Error) AsWarning() CustomError
AsWarning changes the exit code of the Error to -2
func (*Error) GetExitCode ¶
GetExitCode returns the exit code of the Error
func (*Error) GetMessage ¶
GetMessage returns the message of the Error
func (*Error) WithIcon ¶
func (e *Error) WithIcon(icon string) CustomError
type ErrorList ¶
type ErrorList struct {
// contains filtered or unexported fields
}
ErrorList is a list of errors
func GetWarnings ¶
GetWarnings returns a list of warnings from the given errors
func NewErrorList ¶
func (*ErrorList) ToErrorList ¶
ToErrorList returns the underlying error list