mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2190 from ethereum/catch-asm-exceptions
Catch assembler exceptions and throw readable Solidity exceptions
This commit is contained in:
commit
3926e8704a
@ -657,8 +657,33 @@ void CompilerStack::compileContract(
|
||||
cborEncodedMetadata += toCompactBigEndian(cborEncodedMetadata.size(), 2);
|
||||
compiler->compileContract(_contract, _compiledContracts, cborEncodedMetadata);
|
||||
compiledContract.compiler = compiler;
|
||||
|
||||
try
|
||||
{
|
||||
compiledContract.object = compiler->assembledObject();
|
||||
}
|
||||
catch(eth::OptimizerException const&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Assembly optimizer exception for bytecode"));
|
||||
}
|
||||
catch(eth::AssemblyException const&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Assembly exception for bytecode"));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
compiledContract.runtimeObject = compiler->runtimeObject();
|
||||
}
|
||||
catch(eth::OptimizerException const&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Assembly optimizer exception for deployed bytecode"));
|
||||
}
|
||||
catch(eth::AssemblyException const&)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Assembly exception for deployed bytecode"));
|
||||
}
|
||||
|
||||
compiledContract.onChainMetadata = onChainMetadata;
|
||||
_compiledContracts[compiledContract.contract] = &compiler->assembly();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user