Add logging offset for Json parsing errors
This commit is contained in:
@@ -118,16 +118,16 @@ void BinaryAsset::GetImportMetadata(String& path, String& username) const
|
||||
}
|
||||
|
||||
// Parse metadata and try to get import info
|
||||
rapidjson_flax::Document doc;
|
||||
doc.Parse((const char*)Metadata.Get(), Metadata.Length());
|
||||
if (doc.HasParseError() == false)
|
||||
rapidjson_flax::Document document;
|
||||
document.Parse((const char*)Metadata.Get(), Metadata.Length());
|
||||
if (document.HasParseError() == false)
|
||||
{
|
||||
path = JsonTools::GetString(doc, "ImportPath");
|
||||
username = JsonTools::GetString(doc, "ImportUsername");
|
||||
path = JsonTools::GetString(document, "ImportPath");
|
||||
username = JsonTools::GetString(document, "ImportUsername");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::JsonParseException(doc.GetParseError(), GetPath());
|
||||
Log::JsonParseException(document.GetParseError(), document.GetErrorOffset(), GetPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ Asset::LoadResult JsonAssetBase::loadAsset()
|
||||
Document.Parse(data.Get<char>(), data.Length());
|
||||
if (Document.HasParseError())
|
||||
{
|
||||
Log::JsonParseException(Document.GetParseError());
|
||||
Log::JsonParseException(Document.GetParseError(), Document.GetErrorOffset());
|
||||
return LoadResult::CannotLoadData;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ bool JsonStorageProxy::GetAssetInfo(const StringView& path, Guid& resultId, Stri
|
||||
document.Parse((const char*)fileData.Get(), fileData.Count());
|
||||
if (document.HasParseError())
|
||||
{
|
||||
Log::JsonParseException(document.GetParseError(), String(path));
|
||||
Log::JsonParseException(document.GetParseError(), document.GetErrorOffset(), String(path));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ bool JsonStorageProxy::ChangeId(const StringView& path, const Guid& newId)
|
||||
document.Parse((const char*)fileData.Get(), fileData.Count());
|
||||
if (document.HasParseError())
|
||||
{
|
||||
Log::JsonParseException(document.GetParseError(), String(path));
|
||||
Log::JsonParseException(document.GetParseError(), document.GetErrorOffset(), String(path));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user