Include field name when diagnosing field not found:

Closes #3263
This commit is contained in:
John Freeman
2020-02-19 15:30:27 -06:00
committed by Carl Hua
parent f76a5a3183
commit 053b6d9fd3
3 changed files with 30 additions and 15 deletions

View File

@@ -41,7 +41,11 @@ namespace ripple {
class STArray;
//------------------------------------------------------------------------------
inline void
throwFieldNotFound(SField const& field)
{
Throw<std::runtime_error>("Field not found: " + field.getName());
}
class STObject
: public STBase
@@ -492,7 +496,7 @@ public:
STBase* rf = getPField (field, true);
if (! rf)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
if (rf->getSType () == STI_NOTPRESENT)
rf = makeFieldPresent (field);
@@ -552,7 +556,7 @@ private:
const STBase* rf = peekAtPField (field);
if (! rf)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
SerializedTypeID id = rf->getSType ();
@@ -578,7 +582,7 @@ private:
const STBase* rf = peekAtPField (field);
if (! rf)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
SerializedTypeID id = rf->getSType ();
@@ -602,7 +606,7 @@ private:
STBase* rf = getPField (field, true);
if (! rf)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
if (rf->getSType () == STI_NOTPRESENT)
rf = makeFieldPresent (field);
@@ -622,7 +626,7 @@ private:
STBase* rf = getPField (field, true);
if (! rf)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
if (rf->getSType () == STI_NOTPRESENT)
rf = makeFieldPresent (field);
@@ -642,7 +646,7 @@ private:
STBase* rf = getPField (field, true);
if (! rf)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
if (rf->getSType () == STI_NOTPRESENT)
rf = makeFieldPresent (field);