ErrorFromHTTPResponse converts an HTTP response into a grpc error, and uses HTTP response body as an error message. Note that if HTTP response body contains non-utf8 string, then returned error cannot be marshalled by protobuf.
(resp *HTTPResponse)
| 126 | // ErrorFromHTTPResponse converts an HTTP response into a grpc error, and uses HTTP response body as an error message. |
| 127 | // Note that if HTTP response body contains non-utf8 string, then returned error cannot be marshalled by protobuf. |
| 128 | func ErrorFromHTTPResponse(resp *HTTPResponse) error { |
| 129 | return ErrorFromHTTPResponseWithMessage(resp, string(resp.Body)) |
| 130 | } |
| 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 { |