aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/scan_name.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstate/scan_name.cpp')
-rw-r--r--src/libstate/scan_name.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libstate/scan_name.cpp b/src/libstate/scan_name.cpp
index 9e046e8ea..861934200 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;
}
@@ -102,8 +104,11 @@ SCAN_Name::SCAN_Name(const std::string& algo_spec)
if(accum.second != "")
name.push_back(deref_aliases(accum));
- if(level != 0 || name.size() == 0)
- throw Decoding_Error("Bad SCAN name " + algo_spec);
+ if(level != 0)
+ throw Decoding_Error(decoding_error + "Missing close paren");
+
+ if(name.size() == 0)
+ throw Decoding_Error(decoding_error + "Empty name");
alg_name = name[0].second;
@@ -146,7 +151,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];
}