From 2d171c25e57e821c242b2a6ffa9d6e890e8b207e Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 12 Dec 2017 10:10:29 +0100 Subject: Limit number of secondary source locations. --- libsolidity/interface/Exceptions.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libsolidity/interface/Exceptions.h') diff --git a/libsolidity/interface/Exceptions.h b/libsolidity/interface/Exceptions.h index 09301b10..7c66d572 100644 --- a/libsolidity/interface/Exceptions.h +++ b/libsolidity/interface/Exceptions.h @@ -109,6 +109,18 @@ public: infos.push_back(std::make_pair(_errMsg, _sourceLocation)); return *this; } + /// Limits the number of secondary source locations to 32 and appends a notice to the + /// error message. + void limitSize(std::string& _message) + { + size_t occurrences = infos.size(); + if (occurrences > 32) + { + infos.resize(32); + _message += " Truncated from " + boost::lexical_cast(occurrences) + " to the first 32 occurrences."; + } + } + std::vector infos; }; -- cgit v1.2.3