STObject::applyTemplate() throws with description of error:

The `STObject` member function `setType()` has been renamed to
applyTemplate() and modified to throw if there is a template
mismatch.

The error description in the exception is, in certain cases,
used, to better indicate why a particular transaction was
considered ill formed.

Fixes #2585.
This commit is contained in:
Scott Schurr
2018-11-02 17:50:27 -07:00
committed by Nik Bougalis
parent c354809e1c
commit ad5c5f1969
12 changed files with 221 additions and 132 deletions

View File

@@ -73,17 +73,7 @@ void STLedgerEntry::setSLEType ()
Throw<std::runtime_error> ("invalid ledger entry type");
type_ = format->getType ();
if (!setType (format->elements))
{
if (auto j = debugLog().error())
{
j << "Ledger entry not valid for type " << format->getName ();
j << "Object: " << getJson (0);
}
Throw<std::runtime_error> ("ledger entry not valid for type");
}
applyTemplate (format->elements); // May throw
}
std::string STLedgerEntry::getFullText () const