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
| 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. |
| 78 | type 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. |
| 90 | func (e *Error) UnmarshalJSON(bytes []byte) error { |
nothing calls this directly
no outgoing calls
no test coverage detected