15 #include <boost/foreach.hpp>
16 #include <boost/algorithm/string/join.hpp>
34 ErrorMsg::Init(TErrorCode::MEM_LIMIT_EXCEEDED,
"Memory limit exceeded"));
37 "Deprecated RPC; please update your client"));
50 : msg_(new
ErrorMsg(code, arg0, arg1)) {
56 : msg_(new
ErrorMsg(code, arg0, arg1, arg2)) {
61 : msg_(new
ErrorMsg(code, arg0, arg1, arg2, arg3)) {
67 : msg_(new
ErrorMsg(code, arg0, arg1, arg2, arg3, arg4)) {
74 : msg_(new
ErrorMsg(code, arg0, arg1, arg2, arg3, arg4, arg5)) {
81 : msg_(new
ErrorMsg(code, arg0, arg1, arg2, arg3, arg4, arg5, arg6)) {
88 : msg_(new
ErrorMsg(code, arg0, arg1, arg2, arg3, arg4, arg5, arg6,
97 : msg_(new
ErrorMsg(code, arg0, arg1, arg2, arg3, arg4, arg5, arg6,
106 : msg_(new
ErrorMsg(code, arg0, arg1, arg2, arg3, arg4, arg5, arg6,
112 : msg_(new
ErrorMsg(TErrorCode::GENERAL, error_msg)) {
117 : msg_(new ErrorMsg(TErrorCode::GENERAL, error_msg)) {
127 : msg_(status.status_code == TErrorCode::
OK
128 ? NULL : new
ErrorMsg(status.status_code, status.error_msgs)) { }
135 msg_ =
new ErrorMsg(status.status_code, status.error_msgs);
142 hs2_status.statusCode
143 == apache::hive::service::cli::thrift::TStatusCode::SUCCESS_STATUS ? NULL
145 static_cast<TErrorCode::type>(hs2_status.statusCode),
146 hs2_status.errorMessage)) {
150 const apache::hive::service::cli::thrift::TStatus& hs2_status) {
152 if (hs2_status.statusCode
153 == apache::hive::service::cli::thrift::TStatusCode::SUCCESS_STATUS) {
157 static_cast<TErrorCode::type>(hs2_status.statusCode), hs2_status.errorMessage);
163 return Status(error_msg,
true);
167 DCHECK_NOTNULL(
msg_);
173 if (status.
ok())
return;
178 BOOST_FOREACH(
const string& s, status.
msg_->
details()) {
189 status->error_msgs.clear();
194 status->error_msgs.push_back(
msg_->
msg());
196 status->error_msgs.push_back(s);
198 status->__isset.error_msgs =
true;
const std::string & msg() const
Returns the formatted error string.
const std::string GetDetail() const
static const Status DEPRECATED_RPC
strings::internal::SubstituteArg ArgType
void MergeStatus(const Status &status)
TErrorCode::type error() const
void AddDetail(const std::string &msg)
Add a detail string. Calling this method is only defined on a non-OK message.
Status & operator=(const Status &status)
same as copy c'tor
void ToThrift(TStatus *status) const
Convert into TStatus.
void AddDetail(const std::string &d)
Add detail string message.
static const Status CANCELLED
static Status Expected(const std::string &error_msg)
Create a status instance that represents an expected error and will not be logged.
static const Status MEM_LIMIT_EXCEEDED
std::string GetFullMessageDetails() const
static ErrorMsg Init(TErrorCode::type error, const ArgType &arg0=ArgType::NoArg, const ArgType &arg1=ArgType::NoArg, const ArgType &arg2=ArgType::NoArg, const ArgType &arg3=ArgType::NoArg, const ArgType &arg4=ArgType::NoArg, const ArgType &arg5=ArgType::NoArg, const ArgType &arg6=ArgType::NoArg, const ArgType &arg7=ArgType::NoArg, const ArgType &arg8=ArgType::NoArg, const ArgType &arg9=ArgType::NoArg)
const ErrorMsg & msg() const
Returns the error message associated with a non-successful status.
const std::vector< std::string > & details() const