Involved Source Files Package status implements errors returned by gRPC. These errors are
serialized and transmitted on the wire between server and client, and allow
for additional data to be transmitted via the Details field in the status
proto. gRPC service handlers should return an error created by this
package, and gRPC clients should expect a corresponding error to be
returned from the RPC call.
This package upholds the invariants that a non-nil error may not
contain an OK code, and an OK code must result in a nil error.
Package-Level Type Names (total 2)
/* sort by: | */
Error wraps a pointer of a status proto. It implements error and Status,
and a nil *Error should never be returned by this package.(*Error) Error() string GRPCStatus returns the Status represented by se. Is implements future error.Is functionality.
A Error is equivalent if the code and message are identical.
*Error : error
Status represents an RPC status code, message, and details. It is immutable
and should be created with New, Newf, or FromProto. Code returns the status code contained in s. Details returns a slice of details messages attached to the status.
If a detail cannot be decoded, the error is returned in place of the detail.
If the detail can be decoded, the proto message returned is of the same
type that was given to WithDetails(). Err returns an immutable error representing s; returns nil if s.Code() is OK. Message returns the message contained in s. Proto returns s's status as an spb.Status proto message.(*Status) String() string WithDetails returns a new status with the provided details messages appended to the status.
If any errors are encountered, it returns nil and the first error encountered.
*Status : expvar.Var
*Status : fmt.Stringer
func FromProto(s *spb.Status) *Status
func New(c codes.Code, msg string) *Status
func Newf(c codes.Code, format string, a ...any) *Status
func NewWithProto(code codes.Code, message string, statusProto []string) *Status
func (*Error).GRPCStatus() *Status
func (*Status).WithDetails(details ...protoadapt.MessageV1) (*Status, error)
func IsRestrictedControlPlaneCode(s *Status) bool
func RawStatusProto(s *Status) *spb.Status
Package-Level Functions (total 8)
Err returns an error representing c and msg. If c is OK, returns nil.
IsRestrictedControlPlaneCode returns whether the status includes a code
restricted for control plane usage as defined by gRFC A54.
New returns a Status representing c and msg.
Newf returns New(c, fmt.Sprintf(format, a...)).
NewWithProto returns a new status including details from statusProto. This
is meant to be used by the gRPC library only.
RawStatusProto returns the internal protobuf message for use by gRPC itself.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.