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 /solc | |
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 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 23 | ||||
-rw-r--r-- | solc/jsonCompiler.cpp | 16 |
2 files changed, 8 insertions, 31 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index be10faa8..42b65d4c 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -502,21 +502,6 @@ bool CommandLineInterface::processInput() return false; m_compiler->link(m_libraries); } - catch (ParserError const& _exception) - { - SourceReferenceFormatter::printExceptionInformation(cerr, _exception, "Parser error", *m_compiler); - return false; - } - catch (DeclarationError const& _exception) - { - SourceReferenceFormatter::printExceptionInformation(cerr, _exception, "Declaration error", *m_compiler); - return false; - } - catch (TypeError const& _exception) - { - SourceReferenceFormatter::printExceptionInformation(cerr, _exception, "Type error", *m_compiler); - return false; - } catch (CompilerError const& _exception) { SourceReferenceFormatter::printExceptionInformation(cerr, _exception, "Compiler error", *m_compiler); @@ -528,9 +513,13 @@ bool CommandLineInterface::processInput() << boost::diagnostic_information(_exception); return false; } - catch (DocstringParsingError const& _exception) + catch (Error const& _error) { - cerr << "Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_exception) << endl; + if (_error.type() == Error::Type::DocstringParsingError) + cerr << "Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_error) << endl; + else + SourceReferenceFormatter::printExceptionInformation(cerr, _error, _error.typeName(), *m_compiler); + return false; } catch (Exception const& _exception) diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp index 00fd0370..1cf539e5 100644 --- a/solc/jsonCompiler.cpp +++ b/solc/jsonCompiler.cpp @@ -134,17 +134,9 @@ string compile(string _input, bool _optimize) )); success = succ; // keep success false on exception } - catch (ParserError const& exception) + catch (Error const& error) { - errors.append(formatError(exception, "Parser error", compiler)); - } - catch (DeclarationError const& exception) - { - errors.append(formatError(exception, "Declaration error", compiler)); - } - catch (TypeError const& exception) - { - errors.append(formatError(exception, "Type error", compiler)); + errors.append(formatError(error, error.typeName(), compiler)); } catch (CompilerError const& exception) { @@ -154,10 +146,6 @@ string compile(string _input, bool _optimize) { errors.append(formatError(exception, "Internal compiler error", compiler)); } - catch (DocstringParsingError const& exception) - { - errors.append(formatError(exception, "Documentation parsing error", compiler)); - } catch (Exception const& exception) { errors.append("Exception during compilation: " + boost::diagnostic_information(exception)); |