properly handle boost::bad_lexical_cast exceptions

This commit is contained in:
Andrzej Rybczak
2013-09-14 17:26:45 +02:00
parent 7167d036d0
commit 88a3bdb507
8 changed files with 183 additions and 83 deletions

View File

@@ -47,6 +47,7 @@
#include "statusbar.h"
#include "visualizer.h"
#include "title.h"
#include "utility/conversion.h"
namespace boost {//
@@ -251,10 +252,21 @@ int main(int argc, char **argv)
if (input == Key::noOp)
continue;
auto k = Bindings.get(input);
for (; k.first != k.second; ++k.first)
if (k.first->execute())
break;
try
{
auto k = Bindings.get(input);
for (; k.first != k.second; ++k.first)
if (k.first->execute())
break;
}
catch (ConversionError &e)
{
Statusbar::msg("Couldn't convert value '%s' to target type", e.value().c_str());
}
catch (OutOfBounds &e)
{
Statusbar::msg("%s", e.errorMessage().c_str());
}
if (myScreen == myPlaylist)
myPlaylist->EnableHighlighting();