Merge pull request #521

4cede18 console_handler: catch exception inside the input loop (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2015-12-08 20:09:27 +02:00
commit cab6f1239e
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -268,10 +268,11 @@ namespace epee
template<typename t_cmd_handler>
bool run(const std::string& prompt, const std::string& usage, const t_cmd_handler& cmd_handler, std::function<void(void)> exit_handler)
{
TRY_ENTRY();
bool continue_handle = true;
m_prompt = prompt;
while(continue_handle)
{
try
{
if (!m_running)
{
@ -310,10 +311,14 @@ namespace epee
std::cout << usage;
}
}
catch (const std::exception &ex)
{
LOG_ERROR("Exception at [console_handler], what=" << ex.what());
}
}
if (exit_handler)
exit_handler();
return true;
CATCH_ENTRY_L0("console_handler", false);
}
private: