diff options
Diffstat (limited to 'LibMatrix/RoomTypes/GenericRoom.cs')
-rw-r--r-- | LibMatrix/RoomTypes/GenericRoom.cs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs index d11b28d..1398f14 100644 --- a/LibMatrix/RoomTypes/GenericRoom.cs +++ b/LibMatrix/RoomTypes/GenericRoom.cs @@ -84,14 +84,9 @@ public class GenericRoom { } // TODO: should we even error handle here? - public async Task<string> GetNameAsync() { - try { - var res = await GetStateAsync<RoomNameEventContent>("m.room.name"); - return res?.Name ?? RoomId; - } - catch (MatrixException e) { - return $"{RoomId} ({e.ErrorCode})"; - } + public async Task<string?> GetNameAsync() { + var res = await GetStateAsync<RoomNameEventContent>("m.room.name"); + return res?.Name; } public async Task<RoomIdResponse> JoinAsync(string[]? homeservers = null, string? reason = null) { @@ -285,4 +280,4 @@ public class GenericRoom { public class RoomIdResponse { [JsonPropertyName("room_id")] public string RoomId { get; set; } = null!; -} +} \ No newline at end of file |