diff options
author | LianaHus <liana@ethdev.com> | 2015-10-02 20:41:40 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-10-15 02:27:41 +0800 |
commit | 742e5b259a8c88e69f09ede7312673157cd77a1f (patch) | |
tree | 7d1d44995676d828e216078be7803e80cfaf7d0d /libsolidity/Exceptions.h | |
parent | 95ad87267878a168dba98d5eb16e27dc9632465d (diff) | |
download | dexon-solidity-742e5b259a8c88e69f09ede7312673157cd77a1f.tar dexon-solidity-742e5b259a8c88e69f09ede7312673157cd77a1f.tar.gz dexon-solidity-742e5b259a8c88e69f09ede7312673157cd77a1f.tar.bz2 dexon-solidity-742e5b259a8c88e69f09ede7312673157cd77a1f.tar.lz dexon-solidity-742e5b259a8c88e69f09ede7312673157cd77a1f.tar.xz dexon-solidity-742e5b259a8c88e69f09ede7312673157cd77a1f.tar.zst dexon-solidity-742e5b259a8c88e69f09ede7312673157cd77a1f.zip |
added Error class for all kind of errors
Conflicts:
libsolidity/Exceptions.h
Diffstat (limited to 'libsolidity/Exceptions.h')
-rw-r--r-- | libsolidity/Exceptions.h | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/libsolidity/Exceptions.h b/libsolidity/Exceptions.h index 8ab33999..723475c7 100644 --- a/libsolidity/Exceptions.h +++ b/libsolidity/Exceptions.h @@ -31,13 +31,51 @@ namespace dev { namespace solidity { -struct Error: virtual Exception {}; -struct ParserError: virtual Error {}; -struct TypeError: virtual Error {}; -struct DeclarationError: virtual Error {}; -struct DocstringParsingError: virtual Error {}; -struct Warning: virtual Error {}; +class Error: virtual public Exception +{ +public: + enum class Type + { + DeclarationError, + DocstringParsingError, + ParserError, + TypeError, + Warning + }; + + Error(Type _type) : m_type(_type) + { + switch(m_type) + { + case Type::DeclarationError: + m_typeName = "Declaration Error"; + break; + case Type::DocstringParsingError: + m_typeName = "Docstring Parsing Error"; + break; + case Type::ParserError: + m_typeName = "Parser Error"; + break; + case Type::TypeError: + m_typeName = "Type Error"; + break; + case Type::Warning: + m_typeName = "Warning"; + break; + default: + m_typeName = "Error"; + break; + } + } + + Type type() { return m_type; } + std::string const& typeName() const { return m_typeName; } + +private: + Type m_type; + std::string m_typeName; +}; struct CompilerError: virtual Exception {}; struct InternalCompilerError: virtual Exception {}; @@ -56,6 +94,8 @@ public: std::vector<errorSourceLocationInfo> infos; }; + +using ErrorList = std::vector<std::shared_ptr<Error const>>; using errinfo_sourceLocation = boost::error_info<struct tag_sourceLocation, SourceLocation>; using errinfo_secondarySourceLocation = boost::error_info<struct tag_secondarySourceLocation, SecondarySourceLocation>; |