Convert throws and catch alls (RIPD-1046)

This commit is contained in:
Miguel Portilla
2015-11-11 10:47:21 -05:00
committed by Nik Bougalis
parent 0633ef1ba1
commit 880f354b90
127 changed files with 786 additions and 710 deletions

View File

@@ -19,6 +19,7 @@
#include <ripple/app/main/Application.h>
#include <ripple/app/misc/UniqueNodeList.h>
#include <ripple/basics/contract.h>
#include <ripple/core/DatabaseCon.h>
#include <ripple/overlay/impl/Manifest.h>
#include <ripple/protocol/RippleAddress.h>
@@ -46,7 +47,7 @@ make_Manifest (std::string s)
}
return Manifest (std::move (s), *opt_pk, *opt_spk, *opt_seq);
}
catch (...)
catch (std::exception const&)
{
return boost::none;
}
@@ -125,25 +126,25 @@ ManifestCache::configValidatorKey(
if (words.size () != 2)
{
throw std::runtime_error ("[validator_keys] format is `<key> <comment>");
Throw<std::runtime_error> ("[validator_keys] format is `<key> <comment>");
}
Blob key;
if (! Base58::decodeWithCheck (words[0], key))
{
throw std::runtime_error ("Error decoding validator key");
Throw<std::runtime_error> ("Error decoding validator key");
}
if (key.size() != 34)
{
throw std::runtime_error ("Expected 34-byte validator key");
Throw<std::runtime_error> ("Expected 34-byte validator key");
}
if (key[0] != TOKEN_NODE_PUBLIC)
{
throw std::runtime_error ("Expected TOKEN_NODE_PUBLIC (28)");
Throw<std::runtime_error> ("Expected TOKEN_NODE_PUBLIC (28)");
}
if (key[1] != 0xED)
{
throw std::runtime_error ("Expected Ed25519 key (0xED)");
Throw<std::runtime_error> ("Expected Ed25519 key (0xED)");
}
auto const masterKey = PublicKey (Slice(key.data() + 1, key.size() - 1));
@@ -159,16 +160,16 @@ void
ManifestCache::configManifest (
Manifest m, UniqueNodeList& unl, beast::Journal journal)
{
if (!m.verify())
if (! m.verify())
{
throw std::runtime_error("Unverifiable manifest in config");
Throw<std::runtime_error> ("Unverifiable manifest in config");
}
auto const result = applyManifest (std::move(m), unl, journal);
if (result != ManifestDisposition::accepted)
{
throw std::runtime_error("Our own validation manifest was not accepted");
Throw<std::runtime_error> ("Our own validation manifest was not accepted");
}
}
@@ -181,7 +182,7 @@ ManifestCache::addTrustedKey (PublicKey const& pk, std::string comment)
if (value.m)
{
throw std::runtime_error (
Throw<std::runtime_error> (
"New trusted validator key already has a manifest");
}
@@ -352,7 +353,7 @@ void ManifestCache::load (
{
if (!mo->verify())
{
throw std::runtime_error("Unverifiable manifest in db");
Throw<std::runtime_error> ("Unverifiable manifest in db");
}
// add trusted key
map_[mo->masterKey];