mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add exception guard to ReadFileCallback in CLI
This commit is contained in:
parent
aa441668db
commit
b7951be44a
@ -617,6 +617,8 @@ Allowed options)",
|
|||||||
bool CommandLineInterface::processInput()
|
bool CommandLineInterface::processInput()
|
||||||
{
|
{
|
||||||
ReadFile::Callback fileReader = [this](string const& _path)
|
ReadFile::Callback fileReader = [this](string const& _path)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
auto path = boost::filesystem::path(_path);
|
auto path = boost::filesystem::path(_path);
|
||||||
auto canonicalPath = boost::filesystem::canonical(path);
|
auto canonicalPath = boost::filesystem::canonical(path);
|
||||||
@ -645,6 +647,15 @@ bool CommandLineInterface::processInput()
|
|||||||
m_sourceCodes[path.string()] = contents;
|
m_sourceCodes[path.string()] = contents;
|
||||||
return ReadFile::Result{true, contents};
|
return ReadFile::Result{true, contents};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception const& _exception)
|
||||||
|
{
|
||||||
|
return ReadFile::Result{false, "Exception in read callback: " + boost::diagnostic_information(_exception)};
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
return ReadFile::Result{false, "Unknown exception in read callback."};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_args.count(g_argAllowPaths))
|
if (m_args.count(g_argAllowPaths))
|
||||||
|
Loading…
Reference in New Issue
Block a user