about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--LibMatrix/MatrixException.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/LibMatrix/MatrixException.cs b/LibMatrix/MatrixException.cs

index 10f0433..6a0f352 100644 --- a/LibMatrix/MatrixException.cs +++ b/LibMatrix/MatrixException.cs
@@ -11,14 +11,17 @@ public class MatrixException : Exception { public required string Error { get; set; } [JsonPropertyName("soft_logout")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public bool? SoftLogout { get; set; } [JsonPropertyName("retry_after_ms")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int? RetryAfterMs { get; set; } public string RawContent { get; set; } - public string? GetAsJson() => new { ErrorCode, Error, SoftLogout, RetryAfterMs }.ToJson(ignoreNull: true); + public object GetAsObject() => new { ErrorCode, Error, SoftLogout, RetryAfterMs }; + public string GetAsJson() => GetAsObject().ToJson(ignoreNull: true); public override string Message =>