Documentation
¶
Index ¶
- Variables
- func Errorf(format string, args ...interface{}) error
- func GetMessage(lang language.Tag, errorCode ErrorCode, args []interface{}) string
- func IsTaskNotFoundErr(err error) bool
- func IsUnkonwnTimeZoneErr(err error) bool
- func New(message string) error
- func Wrap(err error, message string) error
- func Wrapf(err error, format string, args ...interface{}) error
- type ErrorCode
- type ErrorKind
- type OcsAgentError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // general error codes, range: 1000 ~ 1999 ErrBadRequest = NewErrorCode(1000, badRequest, "err.bad.request") ErrIllegalArgument = NewErrorCode(1001, illegalArgument, "err.illegal.argument") ErrUnexpected = NewErrorCode(1002, unexpected, "err.unexpected") ErrKnown = NewErrorCode(1010, known, "err.known") // ob operation error codes, range: 10000 ~ 10999 ErrUserPermissionDenied = NewErrorCode(10000, unauthorized, "err.user.permission.denied") ErrObclusterNotFound = NewErrorCode(10009, known, "err.obcluster.not.found") // task error codes, range: 2300 ~ 2399 ErrTaskNotFound = NewErrorCode(2300, notFound, "err.task.not.found") ErrTaskCreateFailed = NewErrorCode(2301, known, "err.task.create.failed") )
Functions ¶
func GetMessage ¶
GetMessage will get message from i18n bundle and format it with args
func IsTaskNotFoundErr ¶
func IsUnkonwnTimeZoneErr ¶
Types ¶
type OcsAgentError ¶
type OcsAgentError struct { ErrorCode ErrorCode // error code Args []interface{} // args for error message formatting }
OcsAgentError defines ocsagent error and implements error interface.
func Occur ¶
func Occur(errorCode ErrorCode, args ...interface{}) *OcsAgentError
Occur returns *OcsAgentError composed of errorcode and args
func Occurf ¶
func Occurf(errorCode ErrorCode, format string, args ...interface{}) *OcsAgentError
Occurf formats according to a format specifier (The first one of the `args`) and returns the resulting string as a value that satisfies `OcsAgentError.Args`.
func (OcsAgentError) DefaultMessage ¶
func (e OcsAgentError) DefaultMessage() string
DefaultMessage will return err default message.
Click to show internal directories.
Click to hide internal directories.