Skip to content

Commit 90289ee

Browse files
committed
Gracefully handles missing IPC socket.
1 parent c513413 commit 90289ee

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

test/RPCSession.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,16 @@ string IPCSocket::sendRequest(string const& _req)
139139

140140
RPCSession& RPCSession::instance(const string& _path)
141141
{
142-
static RPCSession session(_path);
143-
BOOST_REQUIRE_EQUAL(session.m_ipcSocket.path(), _path);
144-
return session;
142+
try
143+
{
144+
static RPCSession session(_path);
145+
BOOST_REQUIRE_EQUAL(session.m_ipcSocket.path(), _path);
146+
return session;
147+
}
148+
catch (std::exception const&)
149+
{
150+
BOOST_THROW_EXCEPTION(std::runtime_error("Error creating RPC session for socket: " + _path));
151+
}
145152
}
146153

147154
string RPCSession::eth_getCode(string const& _address, string const& _blockNumber)

test/tools/isoltest.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ TestTool::Result TestTool::process()
124124
catch(boost::exception const& _e)
125125
{
126126
AnsiColorized(cout, m_formatted, {BOLD, RED}) <<
127-
"Exception during syntax test: " << boost::diagnostic_information(_e) << endl;
127+
"Exception during test: " << boost::diagnostic_information(_e) << endl;
128128
return Result::Exception;
129129
}
130130
catch (std::exception const& _e)
131131
{
132132
AnsiColorized(cout, m_formatted, {BOLD, RED}) <<
133-
"Exception during syntax test: " << _e.what() << endl;
133+
"Exception during test: " << _e.what() << endl;
134134
return Result::Exception;
135135
}
136136
catch (...)
137137
{
138138
AnsiColorized(cout, m_formatted, {BOLD, RED}) <<
139-
"Unknown exception during syntax test." << endl;
139+
"Unknown exception during test." << endl;
140140
return Result::Exception;
141141
}
142142

0 commit comments

Comments
 (0)