aboutsummaryrefslogtreecommitdiffstats
path: root/solc
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-15 23:27:32 +0800
committerchriseth <c@ethdev.com>2015-10-15 23:27:32 +0800
commite1e6a0c5319925f1f92f64279081c71738571272 (patch)
treeef22def14ff7b3d69d552a63f4f022e8bac05d18 /solc
parente11e10f8176cd6f866e78b5d12c86fe77367c64a (diff)
parentb2e787b803ffc4a3f13b8578f7029543bd665aed (diff)
downloaddexon-solidity-e1e6a0c5319925f1f92f64279081c71738571272.tar
dexon-solidity-e1e6a0c5319925f1f92f64279081c71738571272.tar.gz
dexon-solidity-e1e6a0c5319925f1f92f64279081c71738571272.tar.bz2
dexon-solidity-e1e6a0c5319925f1f92f64279081c71738571272.tar.lz
dexon-solidity-e1e6a0c5319925f1f92f64279081c71738571272.tar.xz
dexon-solidity-e1e6a0c5319925f1f92f64279081c71738571272.tar.zst
dexon-solidity-e1e6a0c5319925f1f92f64279081c71738571272.zip
Merge pull request #134 from LianaHus/sol_error_types_refuctoring
Sol error types refuctoring
Diffstat (limited to 'solc')
-rw-r--r--solc/CommandLineInterface.cpp25
-rw-r--r--solc/jsonCompiler.cpp21
2 files changed, 13 insertions, 33 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index be10faa8..deae5928 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -496,27 +496,12 @@ bool CommandLineInterface::processInput()
SourceReferenceFormatter::printExceptionInformation(
cerr,
*error,
- (dynamic_pointer_cast<Warning const>(error)) ? "Warning" : "Error", *m_compiler
+ (error->type() == Error::Type::Warning) ? "Warning" : "Error", *m_compiler
);
if (!successful)
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..0746fc88 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -127,24 +127,19 @@ string compile(string _input, bool _optimize)
{
bool succ = compiler.compile(_input, _optimize);
for (auto const& error: compiler.errors())
+ {
+ auto err = dynamic_pointer_cast<Error const>(error);
errors.append(formatError(
*error,
- (dynamic_pointer_cast<Warning const>(error)) ? "Warning" : "Error",
+ (err->type() == Error::Type::Warning) ? "Warning" : "Error",
compiler
));
+ }
success = succ; // keep success false on exception
}
- catch (ParserError const& exception)
- {
- errors.append(formatError(exception, "Parser error", compiler));
- }
- catch (DeclarationError const& exception)
+ catch (Error const& error)
{
- 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 +149,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));