Documentation ¶
Index ¶
- Constants
- func Aborted(w http.ResponseWriter, err error)
- func AlreadyExists(w http.ResponseWriter, err error)
- func Any(w http.ResponseWriter, err error)
- func BadMethod(w http.ResponseWriter, _ error)
- func BadRequest(w http.ResponseWriter, err error)
- func Canceled(w http.ResponseWriter, err error)
- func DataLoss(w http.ResponseWriter, err error)
- func DeadlineExceeded(w http.ResponseWriter, err error)
- func ErrorHandler(_ context.Context, _ *runtime.ServeMux, _ runtime.Marshaler, ...)
- func Exhausted(w http.ResponseWriter, err error)
- func FailedPrecondition(w http.ResponseWriter, err error)
- func Forbidden(w http.ResponseWriter, err error)
- func InternalServerError(w http.ResponseWriter, err error)
- func NotFound(w http.ResponseWriter, _ error)
- func OK(w http.ResponseWriter, data interface{})
- func OutOfRange(w http.ResponseWriter, err error)
- func SystemError(w http.ResponseWriter, _ error)
- func Unauthenticated(w http.ResponseWriter, err error)
- func Unavailable(w http.ResponseWriter, err error)
- func Unimplemented(w http.ResponseWriter, err error)
- func Unknown(w http.ResponseWriter, err error)
- type ErrFunc
- type Response
- type T
Constants ¶
const ( HTMLMIME = "text/html; charset=utf-8" JSONMIME = "application/json; charset=utf-8" TextMIME = "text/plain; charset=utf-8" ContentType = "Content-Type" AccessControl = "Access-Control-Allow-" )
Common MIME types.
const ( StatusUnknown = http.StatusInternalServerError StatusCanceled = http.StatusRequestTimeout StatusDeadlineExceeded = http.StatusRequestTimeout StatusAlreadyExists = http.StatusConflict StatusFailedPrecondition = http.StatusPreconditionFailed StatusAborted = http.StatusConflict StatusDataLoss = http.StatusInternalServerError )
Variables ¶
This section is empty.
Functions ¶
func Aborted ¶
func Aborted(w http.ResponseWriter, err error)
Aborted sends an error response with StatusAborted.
func AlreadyExists ¶
func AlreadyExists(w http.ResponseWriter, err error)
AlreadyExists sends an error response with StatusAlreadyExists.
func Any ¶
func Any(w http.ResponseWriter, err error)
Any determines the type of response to write to the http.ResponseWriter from the error's RPC code. err must != nil. Unknown errors are considered to be Internal Server Errors.
func BadMethod ¶
func BadMethod(w http.ResponseWriter, _ error)
BadMethod reponds with http.StatusMethodNotAllowed.
func BadRequest ¶
func BadRequest(w http.ResponseWriter, err error)
BadRequest sends an error response to with http.StatusNotAcceptable.
func Canceled ¶
func Canceled(w http.ResponseWriter, err error)
Canceled sends an error response with StatusCanceled.
func DataLoss ¶
func DataLoss(w http.ResponseWriter, err error)
Unknown sends an error response with StatusDataLoss.
func DeadlineExceeded ¶
func DeadlineExceeded(w http.ResponseWriter, err error)
DeadlineExceeded sends an error response with StatusDeadlineExceeded.
func ErrorHandler ¶
func Exhausted ¶
func Exhausted(w http.ResponseWriter, err error)
Exhausted sends an error response with http.StatusTooManyRequests.
func FailedPrecondition ¶
func FailedPrecondition(w http.ResponseWriter, err error)
FailedPrecondition sends an error response with StatusFailedPrecondition.
func Forbidden ¶
func Forbidden(w http.ResponseWriter, err error)
Forbidden sends an error response with http.StatusForbidden.
func InternalServerError ¶
func InternalServerError(w http.ResponseWriter, err error)
InternalServerError sends an error response with http.StatusInternalServerError.
func NotFound ¶
func NotFound(w http.ResponseWriter, _ error)
NotFound sends an error response with http.StatusNotFound.
func OK ¶
func OK(w http.ResponseWriter, data interface{})
func OutOfRange ¶
func OutOfRange(w http.ResponseWriter, err error)
OutOfRange sends an error response with http.StatusRequestedRangeNotSatisfiable.
func SystemError ¶
func SystemError(w http.ResponseWriter, _ error)
SystemError responds with a generic error response if marshaling an APIResponse fails.
func Unauthenticated ¶
func Unauthenticated(w http.ResponseWriter, err error)
Unauthenticated sends an error response with http.StatusUnauthorized.
func Unavailable ¶
func Unavailable(w http.ResponseWriter, err error)
Unavailable sends an error response with http.StatusServiceUnavailable.
func Unimplemented ¶
func Unimplemented(w http.ResponseWriter, err error)
Unimplemented sends an error response with http.StatusTooManyRequests.
func Unknown ¶
func Unknown(w http.ResponseWriter, err error)
Unknown sends an error response with StatusUnknown.
Types ¶
type ErrFunc ¶
type ErrFunc func(http.ResponseWriter, error)
ErrFunc is a function that writes the given error to w.
type Response ¶
type Response struct { // Arbitrary response data. Data interface{} `json:"data,omitempty"` // Non-empty if an error occurred. Error string `json:"error,omitempty"` }
Response is a response from a SermoCRM microservice.
type T ¶
type T struct{}
T implements grpc-ecosystem/grpc-gateway/runtime.Marshaler.
func (T) ContentType ¶
ContentType implements grpc-ecosystem/grpc-gateway/runtime.Marshaler.
func (T) NewDecoder ¶
NewDecoder implements grpc-ecosystem/grpc-gateway/runtime.Marshaler.
func (T) NewEncoder ¶
NewEncoder implements grpc-ecosystem/grpc-gateway/runtime.Marshaler.