Documentation ¶
Overview ¶
Package errors provides a way to return detailed information for an RPC request error. The error is normally JSON encoded.
Index ¶
- func BadRequest(id, format string, a ...interface{}) error
- func Conflict(id, format string, a ...interface{}) error
- func Forbidden(id, format string, a ...interface{}) error
- func InternalServerError(id, format string, a ...interface{}) error
- func MethodNotAllowed(id, format string, a ...interface{}) error
- func New(id, detail string, code int32) error
- func NotFound(id, format string, a ...interface{}) error
- func Timeout(id, format string, a ...interface{}) error
- func Unauthorized(id, format string, a ...interface{}) error
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest generates a 400 error.
func Conflict ¶ added in v0.4.0
Conflict generates a 409 error.
func Forbidden ¶
Forbidden generates a 403 error.
func InternalServerError ¶
InternalServerError generates a 500 error.
func MethodNotAllowed ¶ added in v0.12.0
MethodNotAllowed generates a 405 error.
func NotFound ¶
NotFound generates a 404 error.
func Timeout ¶ added in v0.15.0
Timeout generates a 408 error.
Types ¶
type Error ¶
type Error struct { Id string `json:"id"` Code int32 `json:"code"` Detail string `json:"detail"` Status string `json:"status"` }
Error implements the error interface.
func Parse ¶
Parse tries to parse a JSON string into an error. If that fails, it will set the given string as the error detail.
Click to show internal directories.
Click to hide internal directories.