errresponse

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package errresponse implements a custom error renderer for the kobs api as it is described in the chi rest api example, which can be found here: https://github.com/go-chi/chi/blob/master/_examples/rest/main.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(err error, status int, msg string) render.Renderer

Types

type ErrResponse

type ErrResponse struct {
	Err            error  `json:"-"`     // low-level runtime error
	HTTPStatusCode int    `json:"-"`     // http response status code
	StatusText     string `json:"error"` // user-level status message
}

ErrResponse renderer type for handling all sorts of errors.

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