87{
   89 
   90   auto handle_error = [&](const auto& e)
   91   {
   92      wdump((e.to_detail_string()));
 
   93      return e.to_detail_string();
   94   };
   95 
   96   try
   97   {
   99      const auto& var_obj = var.get_object();
  100      if( var_obj.contains( "method" ) )
  101      {
  102         auto call = var.
as<fc::rpc::request>();
 
  104 
  105         auto handle_error_inner = [&](const auto& e)
  106         {
  108           {
  109             return nullptr;
  110           }
  111 
  112           return e.dynamic_copy_exception();
  113         };
  114 
  115         try
  116         {
  119            {
  121               if( send_message )
  123               return reply;
  124            }
  125         }
  126         catch ( const std::bad_alloc& ) 
  127         {
  128            throw;
  129         } 
  130         catch ( const boost::interprocess::bad_alloc& ) 
  131         {
  132            throw;
  133         } 
  135         {
  136            optexcept = handle_error_inner(e);
  137         }
  138         catch ( const std::exception& e )
  139         {
  141         }
  142 
  143         if( optexcept ) {
  144 
  145               auto reply = 
fc::json::to_string( response( *
call.id,  error_object{ 1, optexcept->to_detail_string(), fc::variant(*optexcept)}  ) );
 
  146               if( send_message )
  148 
  149               return reply;
  150         }
  151      }
  152      else
  153      {
  154         auto reply = var.as<fc::rpc::response>();
  156      }
  157   }
  158   catch ( const std::bad_alloc& ) 
  159   {
  160     throw;
  161   } 
  162   catch ( const boost::interprocess::bad_alloc& ) 
  163   {
  164     throw;
  165   } 
  167   {
  168     return handle_error(e);
  169   }
  170   catch ( const std::exception& e)
  171   {
  173   }
  175}
Used to generate a useful error report when an exception is thrown.
static string to_string(const variant &v, const yield_function_t &yield, const output_formatting format=output_formatting::stringify_large_ints_and_doubles)
static variant from_string(const string &utf8_str, const parse_type ptype=parse_type::legacy_parser, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
static std_exception_wrapper from_current_exception(const std::exception &e)
std::shared_ptr< exception > exception_ptr
fc::variant call(const std::string &url, const std::string &path, const T &v)