Documentation ¶
Index ¶
- Constants
- func CheckError(err error)
- func CheckErrorWithCode(err error, exitcode int)
- func FailOnErr(v interface{}, err error) interface{}
- func Fatal(exitcode int, args ...interface{})
- func Fatalf(exitcode int, format string, args ...interface{})
- func IsCredentialsConfigurationError(err error) bool
- func NewCredentialsConfigurationError(err error) error
Constants ¶
View Source
const ( // ErrorCommandSpecific is reserved for command specific indications ErrorCommandSpecific = 1 // ErrorConnectionFailure is returned on connection failure to API endpoint ErrorConnectionFailure = 11 // ErrorAPIResponse is returned on unexpected API response, i.e. authorization failure ErrorAPIResponse = 12 // ErrorResourceDoesNotExist is returned when the requested resource does not exist ErrorResourceDoesNotExist = 13 // ErrorGeneric is returned for generic error ErrorGeneric = 20 )
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
func CheckError(err error)
CheckError logs a fatal message and exits with ErrorGeneric if err is not nil
func CheckErrorWithCode ¶
CheckErrorWithCode is a convenience function to exit if an error is non-nil and exit if it was
func FailOnErr ¶
func FailOnErr(v interface{}, err error) interface{}
FailOnErr panics if there is an error. It returns the first value so you can use it if you cast it: text := FailOrErr(Foo)).(string)
func Fatal ¶
func Fatal(exitcode int, args ...interface{})
Fatal is a wrapper for logrus.Fatal() to exit with custom code
func IsCredentialsConfigurationError ¶
IsCredentialsConfigurationError checks if the given error is a wrapped credentials configuration error.
func NewCredentialsConfigurationError ¶
NewCredentialsConfigurationError wraps any error into a credentials configuration error.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.