mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
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:
committed by
Nik Bougalis
parent
c354809e1c
commit
ad5c5f1969
@@ -804,20 +804,19 @@ static boost::optional <STObject> parseObject (
|
||||
}
|
||||
|
||||
// Some inner object types have templates. Attempt to apply that.
|
||||
if (data.setTypeFromSField (inName) == STObject::typeSetFail)
|
||||
{
|
||||
error = template_mismatch (inName);
|
||||
return boost::none;
|
||||
}
|
||||
data.applyTemplateFromSField (inName); // May throw
|
||||
|
||||
return std::move (data);
|
||||
|
||||
}
|
||||
catch (STObject::FieldErr const&)
|
||||
{
|
||||
error = template_mismatch (inName);
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
error = invalid_data (json_name);
|
||||
return boost::none;
|
||||
}
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
static boost::optional <detail::STVar> parseArray (
|
||||
|
||||
Reference in New Issue
Block a user