@@ -381,7 +381,9 @@ void database::set_chain_id( const chain_id_type& chain_id )
381381
382382const witness_object& database::get_witness ( const account_name_type& name ) const
383383{ try {
384- return get< witness_object, by_name >( name );
384+ const auto * _witness = find_witness ( name );
385+ FC_ASSERT ( _witness != nullptr , " Witness ${w} doesn't exist" , (" w" , name) );
386+ return *_witness;
385387} FC_CAPTURE_AND_RETHROW ( (name) ) }
386388
387389const witness_object* database::find_witness ( const account_name_type& name ) const
@@ -404,7 +406,9 @@ bool database::is_treasury( const account_name_type& name )const
404406
405407const account_object& database::get_account ( const account_id_type id )const
406408{ try {
407- return get< account_object, by_id >( id );
409+ const auto * _account = find_account ( id );
410+ FC_ASSERT ( _account != nullptr , " Account with id ${acc} doesn't exist" , (" acc" , id) );
411+ return *_account;
408412} FC_CAPTURE_AND_RETHROW ( (id) ) }
409413
410414const account_object* database::find_account ( const account_id_type& id )const
@@ -414,7 +418,9 @@ const account_object* database::find_account( const account_id_type& id )const
414418
415419const account_object& database::get_account ( const account_name_type& name )const
416420{ try {
417- return get< account_object, by_name >( name );
421+ const auto * _account = find_account ( name );
422+ FC_ASSERT ( _account != nullptr , " Account ${acc} doesn't exist" , (" acc" , name) );
423+ return *_account;
418424} FC_CAPTURE_AND_RETHROW ( (name) ) }
419425
420426const account_object* database::find_account ( const account_name_type& name )const
@@ -430,7 +436,9 @@ FC_CAPTURE_AND_RETHROW( (comment_id) )
430436
431437const comment_object& database::get_comment ( const account_id_type& author, const shared_string& permlink )const
432438{ try {
433- return get< comment_object, by_permlink >( comment_object::compute_author_and_permlink_hash ( author, to_string ( permlink ) ) );
439+ const comment_object* comment_ptr = find_comment ( author, permlink );
440+ FC_ASSERT ( comment_ptr != nullptr , " Comment with `id` ${author} `permlink` ${permlink} not found" , (author)(permlink) );
441+ return *comment_ptr;
434442} FC_CAPTURE_AND_RETHROW ( (author)(permlink) ) }
435443
436444const comment_object* database::find_comment ( const account_id_type& author, const shared_string& permlink )const
@@ -456,7 +464,9 @@ const comment_object* database::find_comment( const account_name_type& author, c
456464
457465const comment_object& database::get_comment ( const account_id_type& author, const string& permlink )const
458466{ try {
459- return get< comment_object, by_permlink >( comment_object::compute_author_and_permlink_hash ( author, permlink ) );
467+ const comment_object* comment_ptr = find_comment ( author, permlink );
468+ FC_ASSERT ( comment_ptr != nullptr , " Comment with `id` ${author} `permlink` ${permlink} not found" , (author)(permlink) );
469+ return *comment_ptr;
460470} FC_CAPTURE_AND_RETHROW ( (author)(permlink) ) }
461471
462472const comment_object* database::find_comment ( const account_id_type& author, const string& permlink )const
@@ -482,7 +492,9 @@ const comment_object* database::find_comment( const account_name_type& author, c
482492
483493const escrow_object& database::get_escrow ( const account_name_type& name, uint32_t escrow_id )const
484494{ try {
485- return get< escrow_object, by_from_id >( boost::make_tuple ( name, escrow_id ) );
495+ const auto * _escrow = find_escrow ( name, escrow_id );
496+ FC_ASSERT ( _escrow != nullptr , " Escrow balance with 'name' ${name} 'escrow_id' ${escrow_id} doesn't exist." , (name)(escrow_id) );
497+ return *_escrow;
486498} FC_CAPTURE_AND_RETHROW ( (name)(escrow_id) ) }
487499
488500const escrow_object* database::find_escrow ( const account_name_type& name, uint32_t escrow_id )const
@@ -495,7 +507,10 @@ const limit_order_object& database::get_limit_order( const account_name_type& na
495507 if ( !has_hardfork ( HIVE_HARDFORK_0_6__127 ) )
496508 orderid = orderid & 0x0000FFFF ;
497509
498- return get< limit_order_object, by_account >( boost::make_tuple ( name, orderid ) );
510+ const auto * _limit_order = find_limit_order ( name, orderid );
511+ FC_ASSERT ( _limit_order != nullptr , " Limit order with 'name' ${name} 'order_id' ${orderid} doesn't exist." , (name)(orderid) );
512+
513+ return *_limit_order;
499514} FC_CAPTURE_AND_RETHROW ( (name)(orderid) ) }
500515
501516const limit_order_object* database::find_limit_order ( const account_name_type& name, uint32_t orderid )const
@@ -508,7 +523,11 @@ const limit_order_object* database::find_limit_order( const account_name_type& n
508523
509524const savings_withdraw_object& database::get_savings_withdraw ( const account_name_type& owner, uint32_t request_id )const
510525{ try {
511- return get< savings_withdraw_object, by_from_rid >( boost::make_tuple ( owner, request_id ) );
526+
527+ const auto * _savings_withdraw = find_savings_withdraw ( owner, request_id );
528+ FC_ASSERT ( _savings_withdraw != nullptr , " Savings withdraw for `owner` ${owner} and 'request_id' ${request_id} doesn't exist." , (owner)(request_id) );
529+
530+ return *_savings_withdraw;
512531} FC_CAPTURE_AND_RETHROW ( (owner)(request_id) ) }
513532
514533const savings_withdraw_object* database::find_savings_withdraw ( const account_name_type& owner, uint32_t request_id )const
0 commit comments