errors

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 9 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureError

func CaptureError(ctx context.Context, err error)

CaptureError captures an error to sentry & set level as error

func CaptureWarning

func CaptureWarning(ctx context.Context, err error)

CaptureWarning captures an error to sentry & set level as warning

func Code

func Code(err error) int

Code return HTTP status code of the error

func New

func New(args ...interface{}) error

New construct a new error, default having kind Unexpected

func WrapGORMError

func WrapGORMError(op Op, err error) error

WrapGORMError wraps an GORM error into our error such as adding errors.Kind

Types

type Error

type Error struct {
	Op   Op
	Kind Kind
	Err  error
	// contains filtered or unexported fields
}

Error : wego custom error

func (*Error) Error

func (e *Error) Error() string

type FieldError

type FieldError struct {
	validator.FieldError
}

FieldError is wrapper of validator.FieldError

func (FieldError) String

func (e FieldError) String() string

type Kind

type Kind int

Kind error kind

const (
	BadRequest    Kind = http.StatusBadRequest
	Conflict      Kind = http.StatusConflict
	Forbidden     Kind = http.StatusForbidden
	NotFound      Kind = http.StatusNotFound
	Unauthorized  Kind = http.StatusUnauthorized
	Unprocessable Kind = http.StatusUnprocessableEntity
	Unexpected    Kind = http.StatusInternalServerError
)

error kinds

type Op

type Op string

Op : operation

Jump to

Keyboard shortcuts

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