errors

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: Apache-2.0 Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(err string) error

New returns a new error

Types

type ErrorResponse

type ErrorResponse struct {
	Status    int                 `json:"-"`
	ErrorType string              `json:"type"`
	Message   string              `json:"message"`
	Params    map[string][]string `json:"params,omitempty"`
}

ErrorResponse is the json wrapper for API error responses

func BadRequestError

func BadRequestError(message string) *ErrorResponse

BadRequestError returns a bad request error response

func ConflictError

func ConflictError(message string) *ErrorResponse

ConflictError returns a not found error response

func ForbiddenError

func ForbiddenError(message string) *ErrorResponse

ForbiddenError returns a forbidden error response

func InternalServerError

func InternalServerError() *ErrorResponse

InternalServerError returns an internal server error response

func NotFoundError

func NotFoundError(message string) *ErrorResponse

NotFoundError returns a not found error response

func RequestTooLargeError

func RequestTooLargeError(message string) *ErrorResponse

RequestTooLargeError returns a request too large error response

func UnauthorizedError

func UnauthorizedError(message string) *ErrorResponse

UnauthorizedError returns an unauthorized error response

func ValidationError

func ValidationError(message string, params map[string][]string) *ErrorResponse

ValidationError returns a validation error response

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Jump to

Keyboard shortcuts

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