Documentation ¶
Overview ¶
Package errors contains common business errors to be user all over the server.
Index ¶
- Constants
- Variables
- func BadRequest(rw http.ResponseWriter, body interface{})
- func CreateEndpoint(feature features.Features) endpoint.Endpoint
- func DeleteEndpoint(feature features.Features) endpoint.Endpoint
- func FindEndpoint(feature features.Features) endpoint.Endpoint
- func ListEndpoint(feature features.Features) endpoint.Endpoint
- func NotFound(rw http.ResponseWriter, body interface{})
- func UpdateEndpoint(feature features.Features) endpoint.Endpoint
- func ValidateEndpoint(feature features.Features) endpoint.Endpoint
- type Api
- type CollectionSerializer
- type ErrorResponse
- type HTTPResponse
- type NotFoundError
- type Router
- func (router *Router) AddHandler(args RouterArguments)
- func (router *Router) AddMiddleware(pathPrefix string, h http.Handler)
- func (router *Router) AddSubrouter(pathPrefix string) *mux.Router
- func (router *Router) Handler() http.Handler
- func (router *Router) NotFoundHandler(h http.Handler)
- func (router *Router) Subrouter(pathPrefix string) *mux.Router
- type RouterArguments
Constants ¶
View Source
const ( DEFAULT_PORT = ":8000" DEFAULT_TIMEOUT = 10 * time.Second )
View Source
const ( E_BAD_REQUEST string = "bad_request" E_NOT_FOUND string = "not_found" )
Variables ¶
View Source
var (
ErrNotFound = errors.New("The resource requested does not exist.")
)
Functions ¶
func BadRequest ¶
func BadRequest(rw http.ResponseWriter, body interface{})
func NotFound ¶
func NotFound(rw http.ResponseWriter, body interface{})
Types ¶
type CollectionSerializer ¶
type CollectionSerializer struct { Items interface{} `json:"items"` Count int `json:"item_count"` }
func (*CollectionSerializer) Serializer ¶
func (cs *CollectionSerializer) Serializer() string
type ErrorResponse ¶
type ErrorResponse struct { Type string `json:"error,omitempty"` Description string `json:"error_description,omitempty"` }
func NewErrorResponse ¶
func NewErrorResponse(errType, description string) ErrorResponse
func (ErrorResponse) Error ¶
func (err ErrorResponse) Error() string
type HTTPResponse ¶
type HTTPResponse struct { ContentType string `json:"-"` StatusCode int `json:"-"` Body interface{} `json:"body,omitempty"` }
func (*HTTPResponse) ToJson ¶
func (h *HTTPResponse) ToJson() []byte
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
func NewNotFoundError ¶
func NewNotFoundError(err error) NotFoundError
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) AddHandler ¶
func (router *Router) AddHandler(args RouterArguments)
func (*Router) AddMiddleware ¶
func (*Router) NotFoundHandler ¶
type RouterArguments ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.