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 Forbidden(id, format string, a ...interface{}) error
- func InternalServerError(id, format string, a ...interface{}) error
- func New(id, detail string, code int32) error
- func NotFound(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 Forbidden ¶
Forbidden generates a 403 error.
func InternalServerError ¶
InternalServerError generates a 500 error.
func NotFound ¶
NotFound generates a 404 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.
Source Files
¶
- errors.go
Click to show internal directories.
Click to hide internal directories.