errors

package
v0.0.0-...-49a817e Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBcrypt

func FromBcrypt(err error) error

func FromCasbin

func FromCasbin(err error) error

func FromPgx

func FromPgx(err error) error

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reutrns true if not rows found

func IsQueryCancelled

func IsQueryCancelled(err error) bool

IsQueryCancelled returns true if an error is a query cancellation.

func IsUniqueViolation

func IsUniqueViolation(err error) bool

IsUniqueViolation returns true if an error is a unique violation.

Types

type Code

type Code int
const (
	Canceled           Code = 1
	Unknown            Code = 2
	InvalidArgument    Code = 3
	DeadlineExceeded   Code = 4
	NotFound           Code = 5
	AlreadyExists      Code = 6
	PermissionDenied   Code = 7
	ResourceExhausted  Code = 8
	FailedPrecondition Code = 9
	Aborted            Code = 10
	OutOfRange         Code = 11
	Unimplemented      Code = 12
	Internal           Code = 13
	Unavailable        Code = 14
	DataLoss           Code = 15
	Unauthenticated    Code = 16
)

type PkgError

type PkgError struct {
	Code    Code
	Message string
}

PkgError is our core logic error

func FromError

func FromError(err error) PkgError

func New

func New(msg string, code Code) PkgError

New returns a new PkgError which is the core logics error

func (PkgError) Error

func (s PkgError) Error() string

func (PkgError) Status

func (p PkgError) Status() PkgError

Jump to

Keyboard shortcuts

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