errors

package
v0.0.0-...-b236520 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: UPL-1.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

Cause returns the cause error of this error

func Errorf

func Errorf(code ErrorCode, format string, a ...interface{}) error

Errorf formats an error with format

func New

func New(code ErrorCode, message string) error

New constructs a new error

func Wrap

func Wrap(err error, code ErrorCode, message string) error

Wrap waps an error with an error and a message

func Wrapf

func Wrapf(err error, code ErrorCode, format string, a ...interface{}) error

Wrapf warps an error with a error code and a format message

Types

type ErrorCode

type ErrorCode string

ErrorCode is data type of error codes for different kind of errors

const (
	ConfigError    ErrorCode = "SPDL-0001"
	ServerError    ErrorCode = "SPDL-0002"
	LoggingError   ErrorCode = "SPDL-0003"
	InvalidRequest ErrorCode = "SPDL-0004"
)

For common components

const (
	StoreError          ErrorCode = "SPDL-1001"
	EntityNotFound      ErrorCode = "SPDL-1002"
	EntityAlreadyExists ErrorCode = "SPDL-1003"
	ExceedLimit         ErrorCode = "SPDL-1004"
	SerializationError  ErrorCode = "SPDL-1005"
)

For policy management errors

const (
	EvalEngineError   ErrorCode = "SPDL-2001"
	EvalCacheError    ErrorCode = "SPDL-2002"
	BuiltInFuncError  ErrorCode = "SPDL-2003"
	CustomerFuncError ErrorCode = "SPDL-2004"
	DiscoverError     ErrorCode = "SPDL-2005"
)

For evaluator errors

const UnknownError ErrorCode = "SPDL-0000"

UnknownError is the unknown error

func Code

func Code(err error) ErrorCode

Code returns the error code

Jump to

Keyboard shortcuts

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