errs

package
v0.0.0-...-3b8bf74 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIError

func APIError(ctx context.Context, w http.ResponseWriter, code int, err error)

APIError writes default error message and header for a given http status code.

func From

func From(ctx context.Context, code codes.Code, err error) error

From create a new status.Error from a preexisting error.

func IsGormNotFound

func IsGormNotFound(err error) bool

IsGormNotFound returns true if error is related to gorm.ErrRecordNotFound.

func IsPostgresForeignKeyViolationError

func IsPostgresForeignKeyViolationError(err error) bool

IsPostgresForeignKeyViolationError returns true if error is related to foreign key violation.

func IsPostgresNotNullConstraintViolationError

func IsPostgresNotNullConstraintViolationError(err error) bool

IsPostgresNotNullConstraintViolationError returns true if error is related to not null constraint.

func IsPostgresUniqueConstraintViolationError

func IsPostgresUniqueConstraintViolationError(err error) bool

IsPostgresUniqueConstraintViolationError returns true if error is related to unique constraint.

func New

func New(ctx context.Context, code codes.Code, msg string) error

New create a new status.Error from code and message.

func Newf

func Newf(ctx context.Context, code codes.Code, format string, args ...interface{}) error

Newf create a new status.Error from code and message.

func Plain

func Plain(ctx context.Context, code codes.Code) error

Plain create a new status.Error from code.

func SendToSentry

func SendToSentry(ctx context.Context, code codes.Code, err error)

SendToSentry sends an error event to sentry to be captured.

func TryConvertPostgresError

func TryConvertPostgresError(err error) (*pgconn.PgError, bool)

TryConvertPostgresError best effort conversion to pg.Error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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