mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Convert throws to Throws.
This commit is contained in:
committed by
Nik Bougalis
parent
c37261858a
commit
efe4c9cae3
@@ -412,27 +412,27 @@ public:
|
|||||||
case 0:
|
case 0:
|
||||||
// amendment goes from majority to enabled
|
// amendment goes from majority to enabled
|
||||||
if (enabled.find (hash) != enabled.end ())
|
if (enabled.find (hash) != enabled.end ())
|
||||||
throw std::runtime_error ("enabling already enabled");
|
Throw<std::runtime_error> ("enabling already enabled");
|
||||||
if (majority.find (hash) == majority.end ())
|
if (majority.find (hash) == majority.end ())
|
||||||
throw std::runtime_error ("enabling without majority");
|
Throw<std::runtime_error> ("enabling without majority");
|
||||||
enabled.insert (hash);
|
enabled.insert (hash);
|
||||||
majority.erase (hash);
|
majority.erase (hash);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tfGotMajority:
|
case tfGotMajority:
|
||||||
if (majority.find (hash) != majority.end ())
|
if (majority.find (hash) != majority.end ())
|
||||||
throw std::runtime_error ("got majority while having majority");
|
Throw<std::runtime_error> ("got majority while having majority");
|
||||||
majority[hash] = roundTime;
|
majority[hash] = roundTime;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tfLostMajority:
|
case tfLostMajority:
|
||||||
if (majority.find (hash) == majority.end ())
|
if (majority.find (hash) == majority.end ())
|
||||||
throw std::runtime_error ("lost majority without majority");
|
Throw<std::runtime_error> ("lost majority without majority");
|
||||||
majority.erase (hash);
|
majority.erase (hash);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error ("unknown action");
|
Throw<std::runtime_error> ("unknown action");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ populate (Section const& section, std::string const& field, std::ostream& log,
|
|||||||
log << "0.0.0.0 not allowed'" <<
|
log << "0.0.0.0 not allowed'" <<
|
||||||
"' for key '" << field << "' in [" <<
|
"' for key '" << field << "' in [" <<
|
||||||
section.name () << "]\n";
|
section.name () << "]\n";
|
||||||
throw std::exception ();
|
Throw<std::exception> ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ populate (Section const& section, std::string const& field, std::ostream& log,
|
|||||||
{
|
{
|
||||||
log << "IP specified for " << field << " is also for " <<
|
log << "IP specified for " << field << " is also for " <<
|
||||||
"admin: " << ip << " in [" << section.name() << "]\n";
|
"admin: " << ip << " in [" << section.name() << "]\n";
|
||||||
throw std::exception();
|
Throw<std::exception> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ips->emplace_back (addr.first.address ());
|
ips->emplace_back (addr.first.address ());
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ class JSONRPCClient : public AbstractClient
|
|||||||
*pp.ip = address_v4{0x7f000001};
|
*pp.ip = address_v4{0x7f000001};
|
||||||
return { *pp.ip, *pp.port };
|
return { *pp.ip, *pp.port };
|
||||||
}
|
}
|
||||||
throw std::runtime_error("Missing HTTP port");
|
Throw<std::runtime_error>("Missing HTTP port");
|
||||||
|
return {}; // Silence compiler control paths return value warning
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ConstBufferSequence>
|
template <class ConstBufferSequence>
|
||||||
@@ -133,7 +134,8 @@ public:
|
|||||||
{
|
{
|
||||||
auto const result = p.write(bin_.data());
|
auto const result = p.write(bin_.data());
|
||||||
if (result.first)
|
if (result.first)
|
||||||
throw result.first;
|
Throw<boost::system::system_error>(result.first);
|
||||||
|
|
||||||
bin_.consume(result.second);
|
bin_.consume(result.second);
|
||||||
if(p.complete())
|
if(p.complete())
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -136,7 +136,8 @@ class WSClientImpl : public WSClient
|
|||||||
*pp.ip = address_v4{0x7f000001};
|
*pp.ip = address_v4{0x7f000001};
|
||||||
return { *pp.ip, *pp.port };
|
return { *pp.ip, *pp.port };
|
||||||
}
|
}
|
||||||
throw std::runtime_error("Missing WebSocket port");
|
Throw<std::runtime_error>("Missing WebSocket port");
|
||||||
|
return {}; // Silence compiler control paths return value warning
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ConstBuffers>
|
template <class ConstBuffers>
|
||||||
@@ -181,7 +182,8 @@ public:
|
|||||||
error_code ec;
|
error_code ec;
|
||||||
ws_.connect(ec);
|
ws_.connect(ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
throw ec;
|
Throw<boost::system::system_error>(ec);
|
||||||
|
|
||||||
read_frame_op{*this};
|
read_frame_op{*this};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user