rerr

package module
v0.0.0-...-dac3b6d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2018 License: MIT Imports: 1 Imported by: 0

README

rerr

Golang helper for Gorilla JSON RPC 2.0. Common errors with codes and messages.

Not a big deal, just a little helper.

if err != nil {
    rerr.New(rerr.EDuplicate, err)
}

Gorilla JSON RPC 2.0: https://github.com/gorilla/rpc/tree/master/v2

License

MIT

Documentation

Index

Constants

View Source
const (
	EParse      = json2.E_PARSE
	EInvalidReq = json2.E_INVALID_REQ
	ENoMethod   = json2.E_NO_METHOD
	EBadParams  = json2.E_BAD_PARAMS
	EInternal   = json2.E_INTERNAL
	EServer     = json2.E_SERVER

	EUnauthorised   json2.ErrorCode = -32001
	EForbidden      json2.ErrorCode = -32002
	EDuplicate      json2.ErrorCode = -32003
	EBadCredentials json2.ErrorCode = -32004
	ENotFound       json2.ErrorCode = -32005
)

Variables

View Source
var Messages = map[json2.ErrorCode]string{
	EParse:      "Parse error",
	EInvalidReq: "Invalid Request",
	ENoMethod:   "Method not found",
	EBadParams:  "Invalid params",
	EInternal:   "Internal error",
	EServer:     "Server error",

	EUnauthorised:   "Unauthorized",
	EForbidden:      "Forbidden",
	EDuplicate:      "Duplicate value",
	EBadCredentials: "Bad credentials",
	ENotFound:       "Not found",
}

Functions

func New

func New(code json2.ErrorCode, data interface{}) *json2.Error

Types

type Code

type Code int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL