From cff404060b716dd2eefb1a68f39ac36c1a7a14e3 Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Sun, 6 Jul 2014 12:20:54 -0400 Subject: [PATCH] give an error message when we crash from bad command line args This only fixes one case but when you are trying to set up a headless multiplayer game it is pretty annoying when it crashes with no explanation because of a bad controller string. --- src/commandline_options.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commandline_options.cpp b/src/commandline_options.cpp index c32603fade55..41b761112c6d 100644 --- a/src/commandline_options.cpp +++ b/src/commandline_options.cpp @@ -488,7 +488,9 @@ std::vector > commandline_options::parse_ const std::vector tokens = utils::split(s, separator); if (tokens.size()!=2) { - //TODO throw a meaningful exception + std::stringstream ss; + ss << "when trying to parse string " << s << " as an (int,string) with separator " << separator << ", didn't get exactly two tokens."; + throw ss.str(); } elem.get<0>() = lexical_cast(tokens[0]); //TODO catch exception and pack in meaningful something