aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/scan_name.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-12-26 16:32:20 +0000
committerlloyd <[email protected]>2009-12-26 16:32:20 +0000
commit2f362a7d8da1958ef6ab180db6841849ec190076 (patch)
treee147012f42ad4b35a9477415cf2311b8a0a1032c /src/libstate/scan_name.cpp
parent90394a98550551d882fb4d9610b9b8bfa7271c76 (diff)
Improve exception output of SCAN_Name on bad input
Diffstat (limited to 'src/libstate/scan_name.cpp')
-rw-r--r--src/libstate/scan_name.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libstate/scan_name.cpp b/src/libstate/scan_name.cpp
index 9e046e8ea..ded1e97b7 100644
--- a/src/libstate/scan_name.cpp
+++ b/src/libstate/scan_name.cpp
@@ -71,6 +71,8 @@ SCAN_Name::SCAN_Name(const std::string& algo_spec)
u32bit level = 0;
std::pair<u32bit, std::string> accum = std::make_pair(level, "");
+ std::string decoding_error = "Bad SCAN name '" + algo_spec + "': ";
+
for(u32bit i = 0; i != algo_spec.size(); ++i)
{
char c = algo_spec[i];
@@ -82,7 +84,7 @@ SCAN_Name::SCAN_Name(const std::string& algo_spec)
else if(c == ')')
{
if(level == 0)
- throw Decoding_Error("Bad SCAN name " + algo_spec);
+ throw Decoding_Error(decoding_error + "Mismatched parens");
--level;
}
@@ -103,7 +105,7 @@ SCAN_Name::SCAN_Name(const std::string& algo_spec)
name.push_back(deref_aliases(accum));
if(level != 0 || name.size() == 0)
- throw Decoding_Error("Bad SCAN name " + algo_spec);
+ throw Decoding_Error(decoding_error + "Empty name");
alg_name = name[0].second;
@@ -146,7 +148,7 @@ std::string SCAN_Name::algo_name_and_args() const
std::string SCAN_Name::arg(u32bit i) const
{
if(i >= arg_count())
- throw std::range_error("SCAN_Name::argument");
+ throw std::range_error("SCAN_Name::argument - i out of range");
return args[i];
}