1 files changed, 11 insertions, 2 deletions
diff --git a/MatrixRoomUtils.Core/StateEvent.cs b/MatrixRoomUtils.Core/StateEvent.cs
index 8952403..1c0a1cf 100644
--- a/MatrixRoomUtils.Core/StateEvent.cs
+++ b/MatrixRoomUtils.Core/StateEvent.cs
@@ -15,7 +15,16 @@ public class StateEvent {
new ClassCollector<IStateEventType>().ResolveFromAllAccessibleAssemblies();
public object TypedContent {
- get => RawContent.Deserialize(GetType)!;
+ get {
+ try {
+ return RawContent.Deserialize(GetType)!;
+ }
+ catch (JsonException e) {
+ Console.WriteLine(e);
+ Console.WriteLine("Content:\n"+ObjectExtensions.ToJson(RawContent));
+ }
+ return null;
+ }
set => RawContent = JsonSerializer.Deserialize<JsonObject>(JsonSerializer.Serialize(value));
}
@@ -101,4 +110,4 @@ public class StateEvent {
}
public string cdtype => TypedContent.GetType().Name;
-}
\ No newline at end of file
+}
|