Documentation ¶
Index ¶
- func As(err error, target interface{}) bool
- func Code(err error) codes.Code
- func DocURL(err error) string
- func Is(err, target error) bool
- type Error
- func New(code codes.Code, msg ...interface{}) *Error
- func Newf(code codes.Code, fmtStr string, args ...interface{}) *Error
- func WithDocURL(err error, docURL string) *Error
- func Wrap(err error, code codes.Code, msg ...interface{}) *Error
- func Wrapf(err error, code codes.Code, format string, a ...interface{}) *Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Code ¶
Code returns the error code for the given error. If the error is not a flux.Error, this will return Unknown for the code. If the error is a flux.Error and its code is Inherit, then this will return the wrapped error's code.
Types ¶
type Error ¶
type Error struct { // Code is the code of the error as defined in the codes package. // This describes the type and category of the error. It is required. Code codes.Code // Msg contains a human-readable description and additional information // about the error itself. This is optional. Msg string // DocURL contains a link to documentation that is related to explaining // details and/or solutions to this error message. DocURL string // Err contains the error that was the cause of this error. // This is optional. Err error }
Error is the error struct of flux.
func WithDocURL ¶ added in v0.83.0
WithDocURL will annotate an error with a DocURL. If the error is an Error and the DocURL is not filled, it will be set. If the error is not an Error or the DocURL is filled, it will wrap the error and set the DocURL on the wrapper error.
func (*Error) WithDocURL ¶ added in v0.83.0
WithDocURL can be used to add a documentation URL to the error.
Click to show internal directories.
Click to hide internal directories.