aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-05-06 18:18:32 +0800
committerGitHub <noreply@github.com>2017-05-06 18:18:32 +0800
commit822c90573c3d6fc32266e5ed35e465cb24948e56 (patch)
tree9920008f584b4be5176c7f795ae7d4aa845eba9f
parenta09ee1ceae0438d2e09f48a99133cf43f6594644 (diff)
parenta95c86e8e4b328e1fe4aad742d7d700326c6c283 (diff)
downloaddexon-solidity-822c90573c3d6fc32266e5ed35e465cb24948e56.tar.gz
dexon-solidity-822c90573c3d6fc32266e5ed35e465cb24948e56.tar.zst
dexon-solidity-822c90573c3d6fc32266e5ed35e465cb24948e56.zip
Merge pull request #2212 from ethereum/cli-assemble-errors
Catch errors gracefully in CLI assembler
-rw-r--r--solc/CommandLineInterface.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 63d41cdf..0f2e83dc 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -985,13 +985,26 @@ bool CommandLineInterface::assemble()
map<string, shared_ptr<Scanner>> scanners;
for (auto const& src: m_sourceCodes)
{
- auto scanner = make_shared<Scanner>(CharStream(src.second), src.first);
- scanners[src.first] = scanner;
- if (!m_assemblyStacks[src.first].parse(scanner))
- successful = false;
- else
- //@TODO we should not just throw away the result here
- m_assemblyStacks[src.first].assemble();
+ try
+ {
+ auto scanner = make_shared<Scanner>(CharStream(src.second), src.first);
+ scanners[src.first] = scanner;
+ if (!m_assemblyStacks[src.first].parse(scanner))
+ successful = false;
+ else
+ //@TODO we should not just throw away the result here
+ m_assemblyStacks[src.first].assemble();
+ }
+ catch (Exception const& _exception)
+ {
+ cerr << "Exception in assembler: " << boost::diagnostic_information(_exception) << endl;
+ return false;
+ }
+ catch (...)
+ {
+ cerr << "Unknown exception in assembler." << endl;
+ return false;
+ }
}
for (auto const& stack: m_assemblyStacks)
{