1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-09 00:46:19 +00:00

Added debug data on error

This commit is contained in:
Jkorf 2021-08-30 16:48:14 +02:00
parent 4fe2d8f3a6
commit ea2078a1cb

View File

@ -203,20 +203,20 @@ namespace CryptoExchange.Net
} }
catch (JsonReaderException jre) catch (JsonReaderException jre)
{ {
var info = $"{(requestId != null ? $"[{requestId}] " : "")}Deserialize JsonReaderException: {jre.Message}, Path: {jre.Path}, LineNumber: {jre.LineNumber}, LinePosition: {jre.LinePosition}"; var info = $"{(requestId != null ? $"[{requestId}] " : "")}Deserialize JsonReaderException: {jre.Message} Path: {jre.Path}, LineNumber: {jre.LineNumber}, LinePosition: {jre.LinePosition}, data: {obj}";
log.Write(LogLevel.Error, info); log.Write(LogLevel.Error, info);
return new CallResult<T>(default, new DeserializeError(info, obj)); return new CallResult<T>(default, new DeserializeError(info, obj));
} }
catch (JsonSerializationException jse) catch (JsonSerializationException jse)
{ {
var info = $"{(requestId != null ? $"[{requestId}] " : "")}Deserialize JsonSerializationException: {jse.Message}"; var info = $"{(requestId != null ? $"[{requestId}] " : "")}Deserialize JsonSerializationException: {jse.Message} data: {obj}";
log.Write(LogLevel.Error, info); log.Write(LogLevel.Error, info);
return new CallResult<T>(default, new DeserializeError(info, obj)); return new CallResult<T>(default, new DeserializeError(info, obj));
} }
catch (Exception ex) catch (Exception ex)
{ {
var exceptionInfo = ex.ToLogString(); var exceptionInfo = ex.ToLogString();
var info = $"{(requestId != null ? $"[{requestId}] " : "")}Deserialize Unknown Exception: {exceptionInfo}"; var info = $"{(requestId != null ? $"[{requestId}] " : "")}Deserialize Unknown Exception: {exceptionInfo}, data: {obj}";
log.Write(LogLevel.Error, info); log.Write(LogLevel.Error, info);
return new CallResult<T>(default, new DeserializeError(info, obj)); return new CallResult<T>(default, new DeserializeError(info, obj));
} }