Skip to content
Snippets Groups Projects
Commit a7d583e0 authored by ilor's avatar ilor
Browse files

rework regex exception message

parent c3727b43
Branches
No related merge requests found
......@@ -11,21 +11,19 @@ RegexParseError::RegexParseError(
const UErrorCode& status_code,
const UParseError& parse_error)
: WcclError("Could not parse regular expression."),
pattern(pattern),
status(u_errorName(status_code)),
pattern_line(parse_error.line),
offset(parse_error.offset),
pre_context(PwrNlp::to_utf8(UnicodeString(parse_error.preContext))),
error(PwrNlp::to_utf8(UnicodeString(parse_error.postContext))),
expression(PwrNlp::to_utf8(UnicodeString(pattern)))
upe(parse_error)
{
}
std::string RegexParseError::info() const
{
std::stringstream ss;
ss << "Could not parse regular expression at line " << pattern_line
<< " offset " << offset << ". Status: " << status
<< ". Error: " << error << ". Expression was: " << expression;
ss << "Could not parse regular expression at line " << upe.line
<< " offset " << upe.offset << ". Status: " << status
<< ". Error: " << PwrNlp::to_utf8(UnicodeString(upe.postContext))
<< ". Expression was: " << PwrNlp::to_utf8(pattern);
return ss.str();
}
......
......@@ -68,12 +68,9 @@ public:
std::string info() const;
const std::string status;
const int pattern_line;
const int offset;
const std::string pre_context;
const std::string error;
const std::string expression;
UnicodeString pattern;
std::string status;
UParseError upe;
};
} /* end ns Wccl */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment