package
2.1.19+incompatible
Repository: https://github.com/pingcap/pd.git
Documentation: pkg.go.dev

# Functions

ClientData retrieves data from a structure that implements HasClientData If HasClientData is not defined it will use the given ErrorCode object.
NewCode creates a new top-level code.
NewCodedError is for constructing broad error kinds (e.g.
NewInternalErr creates an internalError from an err If the given err is an ErrorCode that is a descendant of InternalCode, its code will be used.
NewInvalidInputErr creates an invalidInput from an err If the error is already an ErrorCode it will use that code Otherwise it will use InvalidInputCode which gives HTTP 400.
NewJSONFormat turns an ErrorCode into a JSONFormat.
NewNotFoundErr creates a notFound from an err If the error is already an ErrorCode it will use that code Otherwise it will use NotFoundCode which gives HTTP 404.
Op adds an operation to an ErrorCode with AddTo.
Operation will return an operation string if it exists.
OperationClientData gives the results of both the ClientData and Operation functions.

# Variables

InternalCode is equivalent to HTTP 500 Internal Server Error.
InvalidInputCode is equivalent to HTTP 400 Bad Request.
NotFoundCode is equivalent to HTTP 404 Not Found.
StateCode is an error that is invalid due to the current object state This is mapped to HTTP 400.

# Structs

A Code has a CodeStr representation.
CodedError is a convenience to attach a code to an error and already satisfy the ErrorCode interface.
EmbedOp is designed to be embedded into your existing error structs.
JSONFormat is an opinion on how to serialize an ErrorCode to JSON.
OpErrCode is an ErrorCode with an "Operation" field attached.

# Interfaces

ErrorCode is the interface that ties an error and RegisteredCode together.
HasClientData is used to defined how to retrieve the data portion of an ErrorCode to be returned to the client.
HasOperation is an interface to retrieve the operation that occurred during an error.

# Type aliases

AddOp is constructed by Op.
CodeStr is a representation of the type of a particular error.
MetaData is a pattern for attaching meta data to codes and inheriting it from a parent.