apperror

package
v0.0.0-...-20f649f Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLoggedOut = &ErrResponse{
	Err:            nil,
	HTTPStatusCode: http.StatusUnauthorized,
	AppErrCode:     http.StatusUnauthorized,
	AppErrMessage:  http.StatusText(http.StatusUnauthorized),
}

Functions

func ErrBadRequest

func ErrBadRequest(err error) render.Renderer

func ErrInternal

func ErrInternal(err error) render.Renderer

func ErrValidation

func ErrValidation(fields validate.Errors) render.Renderer

func IsConflict

func IsConflict(err error) bool

func IsNotFound

func IsNotFound(err error) bool

Types

type ErrResponse

type ErrResponse struct {
	Err            error           `json:"-"`
	HTTPStatusCode int             `json:"-"`
	AppErrCode     int             `json:"code"`
	AppErrMessage  string          `json:"message"`
	Fields         validate.Errors `json:"fields,omitempty"`
}

func (ErrResponse) Render

func (e ErrResponse) Render(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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