From e69b990cf4ac80adac0496d988717b49f41547d0 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Wed, 8 Aug 2018 22:35:21 -0300 Subject: Return '' if there's no m.room.name event for that room See issue #13 in github. --- lib/Matrix/Client/Room.pm6 | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Matrix/Client') diff --git a/lib/Matrix/Client/Room.pm6 b/lib/Matrix/Client/Room.pm6 index d8a9848..fa4501a 100644 --- a/lib/Matrix/Client/Room.pm6 +++ b/lib/Matrix/Client/Room.pm6 @@ -13,6 +13,14 @@ submethod TWEAK { } method !get-name() { + CATCH { + when X::Matrix::Response { + .code ~~ /M_NOT_FOUND/ + ?? ($!name = '') + !! fail + } + default { fail } + } my $data = $.state('m.room.name'); $!name = $data; } -- cgit v1.2.3-70-g09d2