package
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Jun 11, 2017
License: Apache-2.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package errors provides a way to return detailed information
for an RPC request error. The error is normally JSON encoded.
-
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
func BadRequest(id, format string, a ...interface{}) error
BadRequest generates a 400 error.
func Forbidden(id, format string, a ...interface{}) error
Forbidden generates a 403 error.
func InternalServerError(id, format string, a ...interface{}) error
InternalServerError generates a 500 error.
New generates a custom error.
func NotFound(id, format string, a ...interface{}) error
NotFound generates a 404 error.
func Unauthorized(id, format string, a ...interface{}) error
Unauthorized generates a 401 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.
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
¶
Click to show internal directories.
Click to hide internal directories.