Skip to content

Commit 2772c46

Browse files
authored
Improve deserialization exception log (#148)
1 parent cca8710 commit 2772c46

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Assets/Plugins/StreamChat/Core/Exceptions/StreamDeserializationException.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ public class StreamDeserializationException : Exception
1111
public Type TargetType { get; }
1212

1313
public StreamDeserializationException(string content, Type targetType, Exception innerException)
14-
: base($"Failed to deserialize string to type: `{targetType.Name}` ", innerException)
14+
: base($"Failed to deserialize string to type: `{targetType.Name}`", innerException)
1515
{
1616
TargetType = targetType;
1717
Content = content;
1818
}
19+
20+
public override string ToString()
21+
{
22+
var innerExceptionMessage = InnerException != null ? InnerException.ToString() : string.Empty;
23+
return $"Failed to deserialize string to type: `{TargetType.Name}`\nContent: {Content}\nInnerException: {innerExceptionMessage}";
24+
}
1925
}
2026
}

0 commit comments

Comments
 (0)