package errors
import "github.com/influxdata/flux/internal/errors"
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
- func (e *Error) Error() string
- func (e *Error) Unwrap() error
- func (e *Error) WithDocURL(docURL string) *Error
Functions ¶
func As ¶
As is a wrapper around the errors.As function.
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.
func DocURL ¶
DocURL returns the DocURL associated with this error if one exists. This will return the outermost DocURL associated with this error unless the code is Inherit. If the code for an error is Inherit, this will return the DocURL for the nested error if it exists.
func Is ¶
Is is a wrapper around the errors.Is function.
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 New ¶
func Newf ¶
func WithDocURL ¶
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 Wrap ¶
func Wrapf ¶
func (*Error) Error ¶
Error implement the error interface by outputting the Code and Err.
func (*Error) Unwrap ¶
Unwrap will return the wrapped error.
func (*Error) WithDocURL ¶
WithDocURL can be used to add a documentation URL to the error.
Source Files ¶
- Version
- v0.196.1 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 day ago –
Tools for package owners.