Ubuntu 18.04 Upgrade #3

Merged
RoshanSyed merged 143 commits from github/fork/PBSA/master into master 2019-09-03 16:20:50 +00:00
3 changed files with 12 additions and 7 deletions
Showing only changes of commit fa63cd799f - Show all commits

View file

@ -23,7 +23,10 @@ namespace fc { namespace rpc {
response(){}
response( int64_t i, fc::variant r ):id(i),result(r){}
response( int64_t i, error_object r ):id(i),error(r){}
response( int64_t i, fc::variant r, string j ):id(i),jsonrpc(j),result(r){}
response( int64_t i, error_object r, string j ):id(i),jsonrpc(j),error(r){}
int64_t id = 0;
optional<fc::string> jsonrpc;
optional<fc::variant> result;
optional<error_object> error;
};
@ -57,4 +60,4 @@ namespace fc { namespace rpc {
FC_REFLECT( fc::rpc::request, (id)(method)(params) );
FC_REFLECT( fc::rpc::error_object, (code)(message)(data) )
FC_REFLECT( fc::rpc::response, (id)(result)(error) )
FC_REFLECT( fc::rpc::response, (id)(jsonrpc)(result)(error) )

View file

@ -156,7 +156,7 @@ namespace fc
* and other information that is generally only useful for
* developers.
*/
string exception::to_detail_string( log_level ll )const
string exception::to_detail_string( log_level ll )const
{
fc::stringstream ss;
ss << variant(my->_code).as_string() <<" " << my->_name << ": " <<my->_what<<"\n";
@ -174,13 +174,14 @@ namespace fc
/**
* Generates a user-friendly error report.
*/
string exception::to_string( log_level ll )const
string exception::to_string( log_level ll )const
{
fc::stringstream ss;
ss << what() << " (" << variant(my->_code).as_string() <<")\n";
ss << what() << ":";
for( auto itr = my->_elog.begin(); itr != my->_elog.end(); ++itr )
{
ss << fc::format_string( itr->get_format(), itr->get_data() ) <<"\n";
if( itr->get_format().size() )
ss << " " << fc::format_string( itr->get_format(), itr->get_data() );
// ss << " " << itr->get_context().to_string() <<"\n";
}
return ss.str();

View file

@ -90,6 +90,7 @@ std::string websocket_api_connection::on_message(
{
auto var = fc::json::from_string(message);
const auto& var_obj = var.get_object();
if( var_obj.contains( "method" ) )
{
auto call = var.as<fc::rpc::request>();
@ -115,7 +116,7 @@ std::string websocket_api_connection::on_message(
if( call.id )
{
auto reply = fc::json::to_string( response( *call.id, result ) );
auto reply = fc::json::to_string( response( *call.id, result, "2.0" ) );
if( send_message )
_connection.send_message( reply );
return reply;
@ -132,7 +133,7 @@ std::string websocket_api_connection::on_message(
}
if( optexcept ) {
auto reply = fc::json::to_string( response( *call.id, error_object{ 1, optexcept->to_detail_string(), fc::variant(*optexcept)} ) );
auto reply = fc::json::to_string( response( *call.id, error_object{ 1, optexcept->to_string(), fc::variant(*optexcept)}, "2.0" ) );
if( send_message )
_connection.send_message( reply );