ErrorFromHTTPResponseWithMessage converts an HTTP response into a grpc error, and uses supplied message for Error message.
(resp *HTTPResponse, msg string)
| 131 | |
| 132 | // ErrorFromHTTPResponseWithMessage converts an HTTP response into a grpc error, and uses supplied message for Error message. |
| 133 | func ErrorFromHTTPResponseWithMessage(resp *HTTPResponse, msg string) error { |
| 134 | a, err := types.MarshalAny(resp) |
| 135 | if err != nil { |
| 136 | return err |
| 137 | } |
| 138 | |
| 139 | return status.ErrorProto(&spb.Status{ |
| 140 | Code: resp.Code, |
| 141 | Message: msg, |
| 142 | Details: []*types.Any{a}, |
| 143 | }) |
| 144 | } |
| 145 | |
| 146 | // HTTPResponseFromError converts a grpc error into an HTTP response |
| 147 | func HTTPResponseFromError(err error) (*HTTPResponse, bool) { |
no outgoing calls
no test coverage detected