handlers

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadHandler

func LoadHandler(c config.Config) http.Handler

LoadHandler loads the handler for all the requests

Types

type ErrorResponse added in v0.1.5

type ErrorResponse struct {
	Message string              `json:"message"`
	Errors  map[string][]string `json:"errors"`
	Err     error               `json:"-"`
}

ErrorResponse holds the errore response message

func NewErrorResponse added in v0.1.5

func NewErrorResponse(message string, err error) ErrorResponse

NewErrorResponse holds a formatted error response Errors returned from the parser, origin, filter packages Will return in a `key: err` format. Where the key signals the package scope source of the error

func (*ErrorResponse) HandleError added in v0.1.5

func (e *ErrorResponse) HandleError(ctx context.Context, w http.ResponseWriter, code int)

HandleError will both log and handle the http error for a given error response

Jump to

Keyboard shortcuts

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