Documentation ¶
Index ¶
- Constants
- func GetHTTPErrorCode(err error) int
- func MakeAPIHandler(f func(r *http.Request) (resp interface{}, err error)) func(w http.ResponseWriter, r *http.Request)
- func MakeAPIHandlerWWriter(f func(w http.ResponseWriter, r *http.Request) (err error)) func(w http.ResponseWriter, r *http.Request)
- func MakeDesiredContentTypeMiddleware(contentType string) func(inner http.Handler) http.Handler
- func MakeForbiddenError() error
- func MakeInternalServerError(intError error) error
- func MakeInternalServerErrorf(intError error, format string, args ...interface{}) error
- func MakeNotImplementedError() error
- func MakeUnauthorizedError() error
- func RespondWithError(w http.ResponseWriter, r *http.Request, errResp error)
- type ErrorResponse
Constants ¶
View Source
const (
DesiredContentTypeKey = "desiredContentType"
)
Variables ¶
This section is empty.
Functions ¶
func GetHTTPErrorCode ¶
func MakeAPIHandler ¶
func MakeAPIHandlerWWriter ¶
func MakeAPIHandlerWWriter( f func(w http.ResponseWriter, r *http.Request) (err error), ) func(w http.ResponseWriter, r *http.Request)
func MakeForbiddenError ¶
func MakeForbiddenError() error
func MakeInternalServerError ¶
func MakeInternalServerErrorf ¶
MakeInternalServerErrorf returns internalServerError annotated with the formatted message, which does NOT wrap the original error, since we don't want internal server error details to percolate to clients.
func MakeNotImplementedError ¶
func MakeNotImplementedError() error
func MakeUnauthorizedError ¶
func MakeUnauthorizedError() error
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, r *http.Request, errResp error)
Types ¶
type ErrorResponse ¶
func GetErrorStruct ¶
func GetErrorStruct(errResp error) *ErrorResponse
Click to show internal directories.
Click to hide internal directories.