diff --git a/include/rest_rpc/rpc_client.hpp b/include/rest_rpc/rpc_client.hpp index 65b626d..2ea5de6 100644 --- a/include/rest_rpc/rpc_client.hpp +++ b/include/rest_rpc/rpc_client.hpp @@ -41,7 +41,8 @@ class req_result { void as() { if (has_error(data_)) { - throw std::logic_error(get_error_msg(data_)); + std::string err_msg = data_.empty() ? data_ : get_error_msg(data_); + throw std::logic_error(err_msg); } }