Documentation ¶
Overview ¶
Package code defines error code values used by the jrpc2 package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code int32
A Code is an error response code, that satisfies the error interface.
const ( ParseError Code = -32700 // Invalid JSON received by the server InvalidRequest Code = -32600 // The JSON sent is not a valid request object MethodNotFound Code = -32601 // The method does not exist or is unavailable InvalidParams Code = -32602 // Invalid method parameters InternalError Code = -32603 // Internal JSON-RPC error NoError Code = -32099 // Denotes a nil error SystemError Code = -32098 // Errors from the operating environment Cancelled Code = -32097 // Request cancelled DeadlineExceeded Code = -32096 // Request deadline exceeded )
Pre-defined error codes, including the standard ones from the JSON-RPC specification and some specific to this implementation.
func FromError ¶ added in v0.0.22
FromError returns a Code to categorize the specified error. If err == nil, it returns code.NoError. If err is a Code, it returns that code. If err is a Coder, it returns the reported code value. If err is context.Canceled, it returns code.Cancelled. If err is context.DeadlineExceeded, it returns code.DeadlineExceeded. Otherwise it returns code.SystemError.
Click to show internal directories.
Click to hide internal directories.