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

@@ -343,7 +343,7 @@ const STBase& STObject::peekAtField (SField const& field) const
int index = getFieldIndex (field);
if (index == -1)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
return peekAtIndex (index);
}
@@ -353,7 +353,7 @@ STBase& STObject::getField (SField const& field)
int index = getFieldIndex (field);
if (index == -1)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
return getIndex (index);
}
@@ -453,7 +453,7 @@ STBase* STObject::makeFieldPresent (SField const& field)
if (index == -1)
{
if (!isFree ())
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
return getPIndex (emplace_back(detail::nonPresentObject, field));
}
@@ -473,7 +473,7 @@ void STObject::makeFieldAbsent (SField const& field)
int index = getFieldIndex (field);
if (index == -1)
Throw<std::runtime_error> ("Field not found");
throwFieldNotFound(field);
const STBase& f = peekAtIndex (index);