Show full text in tagged_text parse error
This commit is contained in:
parent
2906e31634
commit
b9939ba10e
2 changed files with 4 additions and 4 deletions
|
|
@ -33,7 +33,7 @@ namespace psemek::ui
|
|||
struct parse_error
|
||||
: std::runtime_error
|
||||
{
|
||||
parse_error(std::string error, std::size_t position);
|
||||
parse_error(std::string error, std::size_t position, std::string text);
|
||||
|
||||
std::size_t position() const noexcept { return position_; }
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
namespace psemek::ui
|
||||
{
|
||||
|
||||
tagged_text::parse_error::parse_error(std::string error, std::size_t position)
|
||||
: std::runtime_error(std::move(error) + util::to_string(" at symbol ", position))
|
||||
tagged_text::parse_error::parse_error(std::string error, std::size_t position, std::string text)
|
||||
: std::runtime_error(std::move(error) + util::to_string(" at symbol ", position, ", full text: \"", text, "\""))
|
||||
, position_(position)
|
||||
{}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ namespace psemek::ui
|
|||
|
||||
auto error = [&](std::string message)
|
||||
{
|
||||
throw parse_error(message, current - text.begin());
|
||||
throw parse_error(message, current - text.begin(), std::string(text));
|
||||
};
|
||||
|
||||
bool in_tag = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue