Remove FormatVisitorErrorMessage

Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
This commit is contained in:
Nicholas Van Sickle
2021-12-03 12:26:19 -08:00
parent 016e261f36
commit f2f7dad972
3 changed files with 16 additions and 13 deletions
@@ -103,8 +103,10 @@ namespace AZ::Dom::Json
if (m_entryStack.front().m_entryCount != attributeCount)
{
return VisitorFailure(
VisitorErrorCode::InternalError, "EndObject: Expected %lu attributes but received %lu attributes instead", attributeCount,
m_entryStack.front().m_entryCount);
VisitorErrorCode::InternalError,
AZStd::string::format(
"EndObject: Expected %lu attributes but received %lu attributes instead", attributeCount,
m_entryStack.front().m_entryCount));
}
m_entryStack.pop_front();
@@ -155,8 +157,9 @@ namespace AZ::Dom::Json
if (m_entryStack.front().m_entryCount != elementCount)
{
return VisitorFailure(
VisitorErrorCode::InternalError, "EndArray: Expected %lu elements but received %lu elements instead", elementCount,
m_entryStack.front().m_entryCount);
VisitorErrorCode::InternalError,
AZStd::string::format(
"EndArray: Expected %lu elements but received %lu elements instead", elementCount, m_entryStack.front().m_entryCount));
}
m_entryStack.pop_front();
@@ -507,7 +510,8 @@ namespace AZ::Dom::Json
for (auto it = currentValue.MemberEnd(); it != currentValue.MemberBegin(); --it)
{
auto entry = (it - 1);
const AZStd::string_view key(entry->name.GetString(), aznumeric_cast<size_t>(entry->name.GetStringLength()));
const AZStd::string_view key(
entry->name.GetString(), aznumeric_cast<size_t>(entry->name.GetStringLength()));
entryStack.push(&entry->value);
entryStack.push(key);
}
@@ -60,6 +60,11 @@ namespace AZ::Dom
return AZ::Failure(VisitorError(code));
}
Visitor::Result Visitor::VisitorFailure(VisitorErrorCode code, AZStd::string additionalInfo)
{
return AZ::Failure(VisitorError(code, AZStd::move(additionalInfo)));
}
Visitor::Result Visitor::VisitorFailure(VisitorError error)
{
return AZ::Failure(error);
@@ -227,17 +227,11 @@ namespace AZ::Dom
//! Helper method, constructs a failure \ref Result with the specified code.
static Result VisitorFailure(VisitorErrorCode code);
//! Helper method, constructs a failure \ref Result with the specified code and supplemental info.
static Result VisitorFailure(VisitorErrorCode code, AZStd::string additionalInfo);
//! Helper method, constructs a failure \ref Result with the specified error.
static Result VisitorFailure(VisitorError error);
//! Helper method, constructs a failure \ref Result with the specified code and supplemental info specified by a format string
//! and its arguments.
template<class... TArgs>
static Result VisitorFailure(VisitorErrorCode code, const char* formatString, TArgs... formatArgs)
{
return AZ::Failure(VisitorError(code, AZStd::string::format(formatString, formatArgs...)));
}
//! Helper method, constructs a success \ref Result.
static Result VisitorSuccess();
};