1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-08 00:16:27 +00:00

Adjusted some object response check logging

This commit is contained in:
JKorf 2018-08-10 09:42:25 +02:00
parent c5ee620857
commit 76e7209019

View File

@ -262,6 +262,12 @@ namespace CryptoExchange.Net
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>)) if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>))
return; return;
if (!obj.HasValues && type != typeof(object))
{
log.Write(LogVerbosity.Warning, $"Expected `{type.Name}`, but received object was empty");
return;
}
bool isDif = false; bool isDif = false;
var properties = new List<string>(); var properties = new List<string>();
var props = type.GetProperties(); var props = type.GetProperties();
@ -282,7 +288,7 @@ namespace CryptoExchange.Net
d = properties.SingleOrDefault(p => p.ToLower() == token.Key.ToLower()); d = properties.SingleOrDefault(p => p.ToLower() == token.Key.ToLower());
if (d == null && !(type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>))) if (d == null && !(type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Dictionary<,>)))
{ {
log.Write(LogVerbosity.Warning, $"Didn't find property `{token.Key}` in object of type `{type.Name}`"); log.Write(LogVerbosity.Warning, $"Local object doesn't have property `{token.Key}` expected in type `{type.Name}`");
isDif = true; isDif = true;
continue; continue;
} }
@ -310,7 +316,7 @@ namespace CryptoExchange.Net
continue; continue;
isDif = true; isDif = true;
log.Write(LogVerbosity.Warning, $"Didn't find key `{prop}` in returned data object of type `{type.Name}`"); log.Write(LogVerbosity.Warning, $"Local object has property `{prop}` but was not found in received object of type `{type.Name}`");
} }
if (isDif) if (isDif)