diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-12-12 16:54:33 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-06 19:52:19 +0800 |
commit | d5f40c141b203eb12c4d6fa97418b1a8f0f789bd (patch) | |
tree | e2e8c82f2dd58b3818fdb079ac68c2924ebf5313 /libsolidity/interface/ErrorReporter.cpp | |
parent | 9bd49516d8f10e49b28a51fb68a9dfe195a9bbe4 (diff) | |
download | dexon-solidity-d5f40c141b203eb12c4d6fa97418b1a8f0f789bd.tar.gz dexon-solidity-d5f40c141b203eb12c4d6fa97418b1a8f0f789bd.tar.zst dexon-solidity-d5f40c141b203eb12c4d6fa97418b1a8f0f789bd.zip |
Limit the number of errors output in a single run to 256
Diffstat (limited to 'libsolidity/interface/ErrorReporter.cpp')
-rw-r--r-- | libsolidity/interface/ErrorReporter.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libsolidity/interface/ErrorReporter.cpp b/libsolidity/interface/ErrorReporter.cpp index e6171756..f7260d51 100644 --- a/libsolidity/interface/ErrorReporter.cpp +++ b/libsolidity/interface/ErrorReporter.cpp @@ -61,6 +61,8 @@ void ErrorReporter::warning( void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, string const& _description) { + abortIfExcessive(); + auto err = make_shared<Error>(_type); *err << errinfo_sourceLocation(_location) << @@ -71,6 +73,8 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, st void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) { + abortIfExcessive(); + auto err = make_shared<Error>(_type); *err << errinfo_sourceLocation(_location) << @@ -80,6 +84,16 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, Se m_errorList.push_back(err); } +void ErrorReporter::abortIfExcessive() +{ + if (m_errorList.size() > 256) + { + auto err = make_shared<Error>(Error::Type::Warning); + *err << errinfo_comment("There are more than 256 errors. Aborting."); + m_errorList.push_back(err); + BOOST_THROW_EXCEPTION(FatalError()); + } +} void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, string const& _description) { |