don't log identical error messages

This commit is contained in:
Artem Pavlenko 2019-08-08 11:42:45 +01:00
parent 7d1bfaeb4b
commit f68a147ff4

View file

@ -32,6 +32,7 @@
#include <mapnik/util/noncopyable.hpp> #include <mapnik/util/noncopyable.hpp>
// stl // stl
#include <map> #include <map>
#include <algorithm>
namespace boost { namespace property_tree { namespace detail { namespace rapidxml { namespace boost { namespace property_tree { namespace detail { namespace rapidxml {
template <typename T> class xml_node; template <typename T> class xml_node;
@ -49,7 +50,14 @@ public:
void on_error(std::string const& msg) void on_error(std::string const& msg)
{ {
if (strict_) throw std::runtime_error(msg); if (strict_) throw std::runtime_error(msg);
else error_messages_.push_back(msg); else
{
// avoid duplicate messages
if (std::find(std::begin(error_messages_),std::end(error_messages_), msg) == std::end(error_messages_))
{
error_messages_.push_back(msg);
}
}
} }
error_message_container const& error_messages() const error_message_container const& error_messages() const
{ {