...

Package lderrors

import "github.com/launchdarkly/go-sdk-common/v3/lderrors"
Overview
Index

Overview ▾

Package lderrors provides identifiers for particular kinds of errors that can be returned by code in github.com/launchdarkly/go-sdk-common/v3/ldcontext or github.com/launchdarkly/go-sdk-common/v3/ldattr.

Errors are only defined here if they are specifically generated by those packages. The LaunchDarkly Go SDK (github.com/launchdarkly/go-server-sdk/v6) may define its own error values for additional error conditions that are related to higher-level SDK functionality.

Unlike some packages which define errors as exported global variables, here they are exported as types only. This allows consistent usage regardless of whether a particular kind of error has properties that can vary, or is a singleton with no properties. So, for instance, rather than doing an equality test like this--

if err == lderrors.ErrContextKeyEmpty

--do a type check:

if _, ok := err.(lderrors.ErrContextKeyEmpty); ok

type ErrAttributeEmpty

ErrAttributeEmpty means that you tried to use an uninitialized ldattr.Ref{}, or one that was initialized from an empty string, or from a string that consisted only of a slash.

For details of the attribute reference syntax, see ldattr.Ref.

type ErrAttributeEmpty struct{}

func (ErrAttributeEmpty) Error

func (e ErrAttributeEmpty) Error() string

type ErrAttributeExtraSlash

ErrAttributeExtraSlash means that an attribute reference contained a double slash or trailing slash causing one path component to be empty, such as "/a//b" or "/a/b/".

For details of the attribute reference syntax, see ldattr.Ref.

type ErrAttributeExtraSlash struct{}

func (ErrAttributeExtraSlash) Error

func (e ErrAttributeExtraSlash) Error() string

type ErrAttributeInvalidEscape

ErrAttributeInvalidEscape means that an attribute reference contained contained a "~" character that was not followed by "0" or "1".

For details of the attribute reference syntax, see ldattr.Ref.

type ErrAttributeInvalidEscape struct{}

func (ErrAttributeInvalidEscape) Error

func (e ErrAttributeInvalidEscape) Error() string

type ErrContextKeyEmpty

ErrContextKeyEmpty means that the ldcontext.Context Key field was set to an empty string.

type ErrContextKeyEmpty struct{}

func (ErrContextKeyEmpty) Error

func (e ErrContextKeyEmpty) Error() string

type ErrContextKeyMissing

ErrContextKeyMissing means that the JSON representation of an ldcontext.Context had no "key" property.

type ErrContextKeyMissing struct{}

func (ErrContextKeyMissing) Error

func (e ErrContextKeyMissing) Error() string

type ErrContextKeyNull

ErrContextKeyNull means that the "key" property in the JSON representation of an ldcontext.Context had a null value. This is specific to JSON unmarshaling, since there is no way to specify a null value for this field programmatically.

type ErrContextKeyNull struct{}

func (ErrContextKeyNull) Error

func (e ErrContextKeyNull) Error() string

type ErrContextKindCannotBeKind

ErrContextKindCannotBeKind means that you have tried to set the ldcontext.Context Kind field to the string "kind". The Context schema does not allow this.

type ErrContextKindCannotBeKind struct{}

func (ErrContextKindCannotBeKind) Error

func (e ErrContextKindCannotBeKind) Error() string

type ErrContextKindEmpty

ErrContextKindEmpty means that the "kind" property in the JSON representation of an ldcontext.Context had an empty string value. This is specific to JSON unmarshaling, since if you are creating a Context programmatically, an empty string is automatically changed to ldcontext.DefaultKind.

type ErrContextKindEmpty struct{}

func (ErrContextKindEmpty) Error

func (e ErrContextKindEmpty) Error() string

type ErrContextKindInvalidChars

ErrContextKindInvalidChars means that you have tried to set the ldcontext.Context Kind field to a string that contained disallowed characters.

type ErrContextKindInvalidChars struct{}

func (ErrContextKindInvalidChars) Error

func (e ErrContextKindInvalidChars) Error() string

type ErrContextKindMultiDuplicates

ErrContextKindMultiDuplicates means that you have used an ldcontext constructor or builder for a multi-context and you specified more than one individual Context in it with the same kind.

type ErrContextKindMultiDuplicates struct{}

func (ErrContextKindMultiDuplicates) Error

func (e ErrContextKindMultiDuplicates) Error() string

type ErrContextKindMultiForSingleKind

ErrContextKindMultiForSingleKind means that you have tried to set the ldcontext.Context Kind field to the string "multi" for a single context. The Context schema does not allow this.

type ErrContextKindMultiForSingleKind struct{}

func (ErrContextKindMultiForSingleKind) Error

func (e ErrContextKindMultiForSingleKind) Error() string

type ErrContextKindMultiWithNoKinds

ErrContextKindMultiWithNoKinds means that you have used an ldcontext constructor or builder for a multi-context but you did not specify any individual Contexts in it.

type ErrContextKindMultiWithNoKinds struct{}

func (ErrContextKindMultiWithNoKinds) Error

func (e ErrContextKindMultiWithNoKinds) Error() string

type ErrContextPerKindErrors

ErrContextPerKindErrors means that a multi-context contained at least one kind where the individual Context was invalid. There may be a separate validation error for each kind.

type ErrContextPerKindErrors struct {
    // Errors is a map where each key is the context kind (as a string) and the value is the
    // validation error for that kind.
    Errors map[string]error
}

func (ErrContextPerKindErrors) Error

func (e ErrContextPerKindErrors) Error() string

type ErrContextUninitialized

ErrContextUninitialized means that you have tried to use an empty ldcontext.Context{} struct.

type ErrContextUninitialized struct{}

func (ErrContextUninitialized) Error

func (e ErrContextUninitialized) Error() string