Skip to content

Commit

Permalink
Merge branch 'master' into issue3189
Browse files Browse the repository at this point in the history
  • Loading branch information
zorba80 authored May 22, 2018
2 parents 096f1af + bbcd651 commit 9e35ed0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
12 changes: 9 additions & 3 deletions plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,10 @@ fc::variant read_only::get_block(const read_only::get_block_params& params) cons
read_write::push_block_results read_write::push_block(const read_write::push_block_params& params) {
try {
db.push_block( std::make_shared<signed_block>(params) );
} catch ( ... ) {
} catch ( boost::interprocess::bad_alloc& ) {
raise(SIGUSR1);
} catch ( ... ) {
throw;
}
return read_write::push_block_results();
}
Expand All @@ -547,8 +549,10 @@ read_write::push_transaction_results read_write::push_transaction(const read_wri
pretty_output = db.to_variant_with_abi( *trx_trace_ptr );;
//abi_serializer::to_variant(*trx_trace_ptr, pretty_output, resolver);
id = trx_trace_ptr->id;
} catch ( ... ) {
} catch ( boost::interprocess::bad_alloc& ) {
raise(SIGUSR1);
} catch ( ... ) {
throw;
}
return read_write::push_transaction_results{ id, pretty_output };
}
Expand All @@ -566,8 +570,10 @@ read_write::push_transactions_results read_write::push_transactions(const read_w
fc::mutable_variant_object( "error", e.to_detail_string() ) } );
}
}
} catch ( ... ) {
} catch ( boost::interprocess::bad_alloc& ) {
raise(SIGUSR1);
} catch ( ... ) {
throw;
}
return result;
}
Expand Down
18 changes: 14 additions & 4 deletions programs/nodeos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ void initialize_logging()
logging_conf_loop();
}

enum return_codes {
INITIALIZE_FAIL = -1,
SUCCESS = 0,
BAD_ALLOC = 1,
OTHER_FAIL = 2
};

int main(int argc, char** argv)
{
try {
Expand All @@ -89,25 +96,28 @@ int main(int argc, char** argv)
app().set_default_data_dir(root / "eosio/nodeos/data" );
app().set_default_config_dir(root / "eosio/nodeos/config" );
if(!app().initialize<chain_plugin, http_plugin, net_plugin, producer_plugin>(argc, argv))
return -1;
return INITIALIZE_FAIL;
initialize_logging();
ilog("nodeos version ${ver}", ("ver", eosio::utilities::common::itoh(static_cast<uint32_t>(app().version()))));
ilog("eosio root is ${root}", ("root", root.string()));
app().startup();
app().exec();
} catch (const fc::exception& e) {
elog("${e}", ("e",e.to_detail_string()));
return OTHER_FAIL;
} catch (const boost::interprocess::bad_alloc& e) {
elog("bad alloc");
//elog("${e}", ("e", boost::diagnostic_information(e)));
return 3;
return BAD_ALLOC;
} catch (const boost::exception& e) {
elog("${e}", ("e",boost::diagnostic_information(e)));
return OTHER_FAIL;
} catch (const std::exception& e) {
elog("${e}", ("e",e.what()));
return OTHER_FAIL;
} catch (...) {
elog("unknown exception");
return OTHER_FAIL;
}

return 0;
return SUCCESS;
}

0 comments on commit 9e35ed0

Please sign in to comment.