apperrors

package
v0.0.0-...-63997f1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureInternal

func EnsureInternal(err error) error

func Is

func Is(err error, code Code) bool

Types

type Code

type Code int
const (
	InternalCode Code = iota + 1
	BadRequestCode
	NotFoundCode
	AlreadyExistsCode
	UnauthorizedCode
	ForbiddenCode
	VersionMismatchCode
)

type Error

type Error struct {
	Code       Code
	StackTrace string
	IncidentID string
	// contains filtered or unexported fields
}

func AlreadyExists

func AlreadyExists(subject, key string, value any) *Error

func BadRequest

func BadRequest(err error) *Error

func BadRequestHidden

func BadRequestHidden(err error, message string) *Error

func Forbidden

func Forbidden(message string) *Error

func Internal

func Internal(err error) *Error

func InternalWithoutStackTrace

func InternalWithoutStackTrace(err error) *Error

func NotFound

func NotFound(subject, key string, value any) *Error

func Unauthorized

func Unauthorized(message string) *Error

func UnauthorizedHidden

func UnauthorizedHidden(err error, message string) *Error

func VersionMismatch

func VersionMismatch(subject, key string, value any, version int) *Error

func WrapInternal

func WrapInternal(err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) SafeError

func (e *Error) SafeError() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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