Merge pull request #521
4cede18
console_handler: catch exception inside the input loop (moneromooo-monero)
This commit is contained in:
commit
cab6f1239e
1 changed files with 37 additions and 32 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue