diff options
Diffstat (limited to 'src/libstate/scan_name.cpp')
-rw-r--r-- | src/libstate/scan_name.cpp | 8 |
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]; } |