aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/Exceptions.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-12-12 17:10:29 +0800
committerchriseth <chris@ethereum.org>2017-12-12 17:27:28 +0800
commit2d171c25e57e821c242b2a6ffa9d6e890e8b207e (patch)
tree6a12f54f269b9eee51f60570b1519e0b9adf969a /libsolidity/interface/Exceptions.h
parenteebeb52aed6edb3896137f796aca344eb831cafc (diff)
downloaddexon-solidity-2d171c25e57e821c242b2a6ffa9d6e890e8b207e.tar
dexon-solidity-2d171c25e57e821c242b2a6ffa9d6e890e8b207e.tar.gz
dexon-solidity-2d171c25e57e821c242b2a6ffa9d6e890e8b207e.tar.bz2
dexon-solidity-2d171c25e57e821c242b2a6ffa9d6e890e8b207e.tar.lz
dexon-solidity-2d171c25e57e821c242b2a6ffa9d6e890e8b207e.tar.xz
dexon-solidity-2d171c25e57e821c242b2a6ffa9d6e890e8b207e.tar.zst
dexon-solidity-2d171c25e57e821c242b2a6ffa9d6e890e8b207e.zip
Limit number of secondary source locations.
Diffstat (limited to 'libsolidity/interface/Exceptions.h')
-rw-r--r--libsolidity/interface/Exceptions.h12
1 files changed, 12 insertions, 0 deletions
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<std::string>(occurrences) + " to the first 32 occurrences.";
+ }
+ }
+
std::vector<errorSourceLocationInfo> infos;
};