diff --git a/libs/ui/include/psemek/ui/tagged_text.hpp b/libs/ui/include/psemek/ui/tagged_text.hpp index a04e825c..8f03c1d0 100644 --- a/libs/ui/include/psemek/ui/tagged_text.hpp +++ b/libs/ui/include/psemek/ui/tagged_text.hpp @@ -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_; } diff --git a/libs/ui/source/tagged_text.cpp b/libs/ui/source/tagged_text.cpp index 0e60e4d1..c6ba5d3f 100644 --- a/libs/ui/source/tagged_text.cpp +++ b/libs/ui/source/tagged_text.cpp @@ -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;