errorutil

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MIT Imports: 7 Imported by: 624

Documentation

Overview

Package errorutil provides error handling utilities.

Deprecated: This package is deprecated and will be removed in a future version. Use github.com/projectdiscovery/utils/errkit instead, which provides better error handling with proper Go error chain support and optional stack traces.

Package errorutil provides error handling utilities.

Deprecated: This package is deprecated and will be removed in a future version. Use github.com/projectdiscovery/utils/errkit instead.

Package errorutil provides error handling utilities.

Deprecated: This package is deprecated and will be removed in a future version. Use github.com/projectdiscovery/utils/errkit instead.

Package errorutil provides error handling utilities.

Deprecated: This package is deprecated and will be removed in a future version. Use github.com/projectdiscovery/utils/errkit instead.

Package errorutil provides error handling utilities.

Deprecated: This package is deprecated and will be removed in a future version. Use github.com/projectdiscovery/utils/errkit instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAny deprecated

func IsAny(err error, errxx ...error) bool

IsAny checks if err is not nil and matches any one of errxx errors if match successful returns true else false

Deprecated: Use standard library errors.Is instead.

func IsTimeout deprecated added in v0.0.62

func IsTimeout(err error) bool

IsTimeout checks if error is timeout error

Deprecated: Use standard library errors.Is with context.DeadlineExceeded instead.

Types

type ErrCallback deprecated

type ErrCallback func(level ErrorLevel, err string, tags ...string)

ErrCallback function to handle given error

Deprecated: Use errkit.ErrorX and its structured logging capabilities instead.

type ErrWithFmt deprecated added in v0.0.7

type ErrWithFmt struct {
	// contains filtered or unexported fields
}

ErrWithFmt is a simplified version of err holding a default format

Deprecated: Use errkit.ErrorX instead.

func NewWithFmt deprecated added in v0.0.7

func NewWithFmt(fmt string) ErrWithFmt

NewWithFmt creates a new ErrWithFmt

Deprecated: Use errkit.New instead.

func (*ErrWithFmt) Error deprecated added in v0.0.7

func (e *ErrWithFmt) Error()

Error implements error interface

Deprecated: Use errkit.ErrorX instead.

func (*ErrWithFmt) Msgf deprecated added in v0.0.7

func (e *ErrWithFmt) Msgf(args ...any) error

Msgf wraps given message

Deprecated: Use errkit.ErrorX instead.

type Error deprecated

type Error interface {
	// WithTag assigns tag[s] to Error
	//
	// Deprecated: Use errkit.ErrorX instead.
	WithTag(tag ...string) Error
	// WithLevel assigns given ErrorLevel
	//
	// Deprecated: Use errkit.ErrorX instead.
	WithLevel(level ErrorLevel) Error
	// Error is interface method of 'error'
	//
	// Deprecated: Use errkit.ErrorX instead.
	Error() string
	// Unwrap returns the underlying error
	//
	// Deprecated: Use errkit.ErrorX instead.
	Unwrap() error
	// Wraps existing error with errors (skips if passed error is nil)
	//
	// Deprecated: Use errkit.ErrorX instead.
	Wrap(err ...error) Error
	// Msgf wraps error with given message
	//
	// Deprecated: Use errkit.ErrorX instead.
	Msgf(format string, args ...any) Error
	// Equal Checks Equality of errors
	//
	// Deprecated: Use errkit.ErrorX instead.
	Equal(err ...error) bool
	// WithCallback execute ErrCallback function when Error is triggered
	//
	// Deprecated: Use errkit.ErrorX instead.
	WithCallback(handle ErrCallback) Error
}

Error is enriched version of normal error with tags and other methods

Deprecated: Use errkit.ErrorX instead.

func New deprecated

func New(format string, args ...any) Error

New creates a new error

Deprecated: Use errkit.New instead.

func NewWithErr deprecated

func NewWithErr(err error) Error

NewWithErr creates a new error with an existing error

Deprecated: Use errkit.FromError instead.

func NewWithTag deprecated

func NewWithTag(tag string, format string, args ...any) Error

NewWithTag creates an error with tag

Deprecated: Use errkit.New instead.

func WrapfWithNil deprecated

func WrapfWithNil(err error, format string, args ...any) Error

WrapfWithNil returns nil if error is nil but if err is not nil wraps error with given msg unlike errors.Wrapf

Deprecated: Use errkit.FromError instead.

func WrapwithNil deprecated

func WrapwithNil(err error, errx ...error) Error

WrapwithNil returns nil if err is nil but wraps it with given errors continuously if it is not nil

Deprecated: Use errkit.FromError instead.

type ErrorLevel deprecated

type ErrorLevel uint

ErrorLevel represents the severity level of an error

Deprecated: Use errkit.ErrKind instead.

const (
	// Panic level error
	//
	// Deprecated: Use errkit.ErrKind instead.
	Panic ErrorLevel = iota
	// Fatal level error
	//
	// Deprecated: Use errkit.ErrKind instead.
	Fatal
	// Runtime level error (Default)
	//
	// Deprecated: Use errkit.ErrKind instead.
	Runtime
)

func (ErrorLevel) String deprecated

func (l ErrorLevel) String() string

String returns string representation of ErrorLevel

Deprecated: Use errkit.ErrKind instead.

Jump to

Keyboard shortcuts

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