Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Buck <cbuck@lantis.de>2013-04-12 22:44:02 +0400
committerChristian Buck <cbuck@lantis.de>2013-04-12 22:44:02 +0400
commit464b75212849d72403884f4847b1e497ff141d12 (patch)
treebfe9362a5f6a0d99b23f390bcda2f238faacbd61 /moses/Util.cpp
parentbb5d70fc7cdf864f1594e70260633242fb49af26 (diff)
parentf007a144f5eb7c7f437520a8223fae8a97633ff7 (diff)
Merge branch 'master' of git://github.com/moses-smt/mosesdecoder
Diffstat (limited to 'moses/Util.cpp')
-rw-r--r--moses/Util.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/moses/Util.cpp b/moses/Util.cpp
index d82774b07..13cee27f9 100644
--- a/moses/Util.cpp
+++ b/moses/Util.cpp
@@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "TypeDef.h"
#include "Util.h"
#include "Timer.h"
+#include "util/exception.hh"
#include "util/file.hh"
using namespace std;
@@ -65,6 +66,8 @@ const std::string ToLower(const std::string& str)
return lc;
}
+class BoolValueException : public util::Exception {};
+
template<>
bool Scan<bool>(const std::string &input)
{
@@ -73,8 +76,7 @@ bool Scan<bool>(const std::string &input)
return true;
if (lc == "no" || lc == "n" || lc =="false" || lc == "0")
return false;
- TRACE_ERR( "Scan<bool>: didn't understand '" << lc << "', returning false" << std::endl);
- return false;
+ UTIL_THROW(BoolValueException, "Could not interpret " << input << " as a boolean. After lowercasing, valid values are yes, y, true, 1, no, n, false, and 0.");
}
bool FileExists(const std::string& filePath)