error

package
v0.0.0-...-e3d78ff Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrResponse

type ErrResponse struct {
	Err            error  `json:"-"`               // low-level runtime error
	HTTPStatusCode int    `json:"-"`               // http response status code
	Message        string `json:"error,omitempty"` // application-level error message, for debugging
}

ErrResponse is base struct for JSON API error response

func BadRequest

func BadRequest(err error, msg string) *ErrResponse

BadRequest returns ErrResponse for bad request http error

func InvalidParameter

func InvalidParameter(err error, msg string) *ErrResponse

InvalidParameter returns ErrResponse for invalid parameter error

func (*ErrResponse) Render

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

Render implements chi.Render interface for ErrResponse

Jump to

Keyboard shortcuts

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