handler

package
v0.0.0-...-db01812 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	Error   error  `json:"-"`
	Message string `json:"message"`
	Code    int    `json:"code"`
}

AppError represents an error as returned by this application. It works in tandem with AppHandler for easy handling of errors.

func AuthenticateOrganization

func AuthenticateOrganization(w http.ResponseWriter, r *http.Request,
	_ *model.Organization) *AppError

func CreateOrganization

func CreateOrganization(w http.ResponseWriter, r *http.Request,
	o *model.Organization) *AppError

func ErrCreatingModel

func ErrCreatingModel(err error) *AppError

func ErrDatabase

func ErrDatabase(err error) *AppError

func ErrInvalidID

func ErrInvalidID(err error) *AppError

func ErrNotFound

func ErrNotFound(err error) *AppError

func ErrUnauthorized

func ErrUnauthorized() *AppError

func ErrUnmarshalling

func ErrUnmarshalling(err error) *AppError

func GetAllOrganizations

func GetAllOrganizations(w http.ResponseWriter, r *http.Request,
	_ *model.Organization) *AppError

func GetAllShelters

func GetAllShelters(w http.ResponseWriter, r *http.Request,
	_ *model.Organization) *AppError

func GetOrganization

func GetOrganization(w http.ResponseWriter, r *http.Request,
	o *model.Organization) *AppError

type AppHandler

AppHandler is a type that implements http.Handler and makes handling errors easier. When its method returns an error, it prints it to the logs and shows a JSON formatted error to the user.

func (AppHandler) ServeHTTP

func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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