MCPcopy Create free account
hub / github.com/DoNewsCode/core / Error

Struct Error

unierr/error.go:78–87  ·  view source on GitHub ↗

Error is the unified error type for HTTP/gRPC transports. In grpc transports, Error can not only be constructed from a grpc status but also producing a native grpc status. In HTTP transports, Error can be encoded and decoded in json format. It also infers HTTP status code. The roundtrip conversion

Source from the content-addressed store, hash-verified

76// The roundtrip conversion makes Error suitable as a unification error model, on both client side and server side.
77// Note the json format follows the JSONRPC standard.
78type Error struct {
79 err error
80 msg string
81 args []interface{}
82 code codes.Code
83 // Printer can ben used to achieve i18n. By default it is a text.BasePrinter.
84 Printer contract.Printer
85 // HttpStatusCodeFunc can overwrites the inferred HTTP status code from gRPC status.
86 HttpStatusCodeFunc func(code codes.Code) int
87}
88
89// UnmarshalJSON implements json.Unmarshaler.
90func (e *Error) UnmarshalJSON(bytes []byte) error {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected