| 29 | namespace impala { |
| 30 | |
| 31 | Status StatusFromThrift(const TStatus& status) { |
| 32 | if (status.status_code == TErrorCode::OK) return Status::OK(); |
| 33 | |
| 34 | ErrorMsg msg; |
| 35 | msg.SetErrorCode(status.status_code); |
| 36 | if (status.error_msgs.size() > 0) { |
| 37 | // The first message is the actual error message. (See StatusToThrift()). |
| 38 | msg.SetErrorMsg(status.error_msgs.front()); |
| 39 | // The following messages are details. |
| 40 | std::for_each(status.error_msgs.begin() + 1, status.error_msgs.end(), |
| 41 | [&](string const& detail) { msg.AddDetail(detail); }); |
| 42 | } |
| 43 | return Status(msg); |
| 44 | } |
| 45 | |
| 46 | Status StatusFromProto(const StatusPB& status) { |
| 47 | if (status.status_code() == TErrorCode::OK) return Status::OK(); |