go-micro: github.com/micro/go-micro/errors Index | Files

package errors

import "github.com/micro/go-micro/errors"

Package errors provides a way to return detailed information for an RPC request error. The error is normally JSON encoded.


Package Files


func BadRequest Uses

func BadRequest(id, format string, a ...interface{}) error

BadRequest generates a 400 error.

func Conflict Uses

func Conflict(id, format string, a ...interface{}) error

Conflict generates a 409 error.

func Forbidden Uses

func Forbidden(id, format string, a ...interface{}) error

Forbidden generates a 403 error.

func InternalServerError Uses

func InternalServerError(id, format string, a ...interface{}) error

InternalServerError generates a 500 error.

func MethodNotAllowed Uses

func MethodNotAllowed(id, format string, a ...interface{}) error

MethodNotAllowed generates a 405 error.

func New Uses

func New(id, detail string, code int32) error

New generates a custom error.

func NotFound Uses

func NotFound(id, format string, a ...interface{}) error

NotFound generates a 404 error.

func Timeout Uses

func Timeout(id, format string, a ...interface{}) error

Timeout generates a 408 error.

func Unauthorized Uses

func Unauthorized(id, format string, a ...interface{}) error

Unauthorized generates a 401 error.

type Error Uses

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 Uses

func Parse(err string) *Error

Parse tries to parse a JSON string into an error. If that fails, it will set the given string as the error detail.

func (*Error) Error Uses

func (e *Error) Error() string

Package errors imports 3 packages (graph) and is imported by 416 packages. Updated 2019-11-04. Refresh now. Tools for package owners.