aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-27 05:52:11 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-27 06:25:43 +0800
commitfb7eec8dd5d6a92c233fd8104b76568c89021552 (patch)
treee5687f5d9eb6cea2d26acde2c2f08c4836b47b05
parenta605e4eb957f65ab172015bd4f03ee56445a9f91 (diff)
downloaddexon-solidity-fb7eec8dd5d6a92c233fd8104b76568c89021552.tar.gz
dexon-solidity-fb7eec8dd5d6a92c233fd8104b76568c89021552.tar.zst
dexon-solidity-fb7eec8dd5d6a92c233fd8104b76568c89021552.zip
Catch FatalError in StandardCompiler
-rw-r--r--libsolidity/interface/StandardCompiler.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index 23687340..48015ee6 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -285,6 +285,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
));
}
}
+ /// This is only thrown in a very few locations.
catch (Error const& _error)
{
if (_error.type() == Error::Type::DocstringParsingError)
@@ -300,10 +301,20 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
false,
_error.typeName(),
"general",
- "",
+ "Uncaught error: ",
scannerFromSourceName
));
}
+ /// This should not be leaked from compile().
+ catch (FatalError const& _exception)
+ {
+ errors.append(formatError(
+ false,
+ "FatalError",
+ "general",
+ "Uncaught fatal error: " + boost::diagnostic_information(_exception)
+ ));
+ }
catch (CompilerError const& _exception)
{
errors.append(formatErrorWithException(
@@ -322,7 +333,8 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
false,
"InternalCompilerError",
"general",
- "Internal compiler error (" + _exception.lineInfo() + ")", scannerFromSourceName
+ "Internal compiler error (" + _exception.lineInfo() + ")",
+ scannerFromSourceName
));
}
catch (UnimplementedFeatureError const& _exception)
@@ -333,7 +345,8 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
"UnimplementedFeatureError",
"general",
"Unimplemented feature (" + _exception.lineInfo() + ")",
- scannerFromSourceName));
+ scannerFromSourceName
+ ));
}
catch (Exception const& _exception)
{