waferrors

package
v4.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrContextClosed is returned when an operation is attempted on a
	// [github.com/DataDog/go-libddwaf/v4.Context] that has already been closed.
	ErrContextClosed = errors.New("closed WAF context")

	// ErrMaxDepthExceeded is returned when the WAF encounters a value that
	// exceeds the maximum depth.
	ErrMaxDepthExceeded = errors.New("max depth exceeded")
	// ErrUnsupportedValue is returned when the WAF encounters a value that
	// is not supported by the encoder or decoder.
	ErrUnsupportedValue = errors.New("unsupported Go value")
	// ErrInvalidMapKey is returned when the WAF encounters an invalid map key.
	ErrInvalidMapKey = errors.New("invalid WAF object map key")
	// ErrNilObjectPtr is returned when the WAF encounters a nil object pointer at
	// an unexpected location.
	ErrNilObjectPtr = errors.New("nil WAF object pointer")
	// ErrInvalidObjectType is returned when the WAF encounters an invalid type
	// when decoding a value.
	ErrInvalidObjectType = errors.New("invalid type encountered when decoding")
	// ErrTooManyIndirections is returned when the WAF encounters a value that
	// exceeds the maximum number of indirections (pointer to pointer to...).
	ErrTooManyIndirections = errors.New("too many indirections")
)

Functions

func ToWafErrorCode

func ToWafErrorCode(in error) int

ToWafErrorCode converts an error to a WAF error code, returns zero if the error is not a RunError.

Types

type CgoDisabledError

type CgoDisabledError struct{}

func (CgoDisabledError) Error

func (e CgoDisabledError) Error() string

type ManuallyDisabledError

type ManuallyDisabledError struct{}

ManuallyDisabledError is a wrapper error type helping to handle the error case of trying to execute this package when the WAF has been manually disabled with the `datadog.no_waf` go build tag.

func (ManuallyDisabledError) Error

func (e ManuallyDisabledError) Error() string

type PanicError

type PanicError struct {
	// The recovered panic error while executing the function `in`.
	Err error
	// The function symbol name that was given to `tryCall()`.
	In string
}

PanicError is an error type wrapping a recovered panic value that happened during a function call. Such error must be considered unrecoverable and be used to try to gracefully abort. Keeping using this package after such an error is unreliable and the caller must rather stop using the library. Examples include safety checks errors.

func (*PanicError) Error

func (e *PanicError) Error() string

Error returns the error string representation.

func (*PanicError) Unwrap

func (e *PanicError) Unwrap() error

Unwrap the error and return it. Required by errors.Is and errors.As functions.

type RunError

type RunError int

RunError the WAF can return when running it.

const (
	// ErrInternal denotes a WAF internal error.
	ErrInternal RunError = iota + 1
	// ErrInvalidObject is returned when the WAF received an invalid object.
	ErrInvalidObject
	// ErrInvalidArgument is returned when the WAF received an invalid argument.
	ErrInvalidArgument
	// ErrTimeout is returned when the WAF ran out of time budget to spend.
	ErrTimeout
	// ErrOutOfMemory is returned when the WAF ran out of memory when trying to
	// allocate a result object.
	ErrOutOfMemory
	// ErrEmptyRuleAddresses is returned when the WAF received an empty list of
	// rule addresses.
	ErrEmptyRuleAddresses
)

Errors the WAF can return when running it.

func (RunError) Error

func (e RunError) Error() string

Error returns the string representation of the RunError.

type UnsupportedGoVersionError

type UnsupportedGoVersionError struct{}

UnsupportedGoVersionError is a wrapper error type helping to handle the error case of trying to execute this package when the Go version is not supported.

func (UnsupportedGoVersionError) Error

type UnsupportedOSArchError

type UnsupportedOSArchError struct {
	OS   string
	Arch string
}

UnsupportedOSArchError is a wrapper error type helping to handle the error case of trying to execute this package when the OS or architecture is not supported.

func (UnsupportedOSArchError) Error

func (e UnsupportedOSArchError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL