diff --git a/Code/Framework/AzCore/AzCore/DOM/Backends/JSON/JsonSerializationUtils.cpp b/Code/Framework/AzCore/AzCore/DOM/Backends/JSON/JsonSerializationUtils.cpp index 66851f1a40..4adf0bdd21 100644 --- a/Code/Framework/AzCore/AzCore/DOM/Backends/JSON/JsonSerializationUtils.cpp +++ b/Code/Framework/AzCore/AzCore/DOM/Backends/JSON/JsonSerializationUtils.cpp @@ -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(entry->name.GetStringLength())); + const AZStd::string_view key( + entry->name.GetString(), aznumeric_cast(entry->name.GetStringLength())); entryStack.push(&entry->value); entryStack.push(key); } diff --git a/Code/Framework/AzCore/AzCore/DOM/DomVisitor.cpp b/Code/Framework/AzCore/AzCore/DOM/DomVisitor.cpp index d5190cbbac..ad314da385 100644 --- a/Code/Framework/AzCore/AzCore/DOM/DomVisitor.cpp +++ b/Code/Framework/AzCore/AzCore/DOM/DomVisitor.cpp @@ -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); diff --git a/Code/Framework/AzCore/AzCore/DOM/DomVisitor.h b/Code/Framework/AzCore/AzCore/DOM/DomVisitor.h index 26fb2aa063..bbe78131c3 100644 --- a/Code/Framework/AzCore/AzCore/DOM/DomVisitor.h +++ b/Code/Framework/AzCore/AzCore/DOM/DomVisitor.h @@ -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 - 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(); };