aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2018-08-08 22:35:21 -0300
committerMatias Linares <matiaslina@gmail.com>2018-08-08 22:35:21 -0300
commite69b990cf4ac80adac0496d988717b49f41547d0 (patch)
tree7bec7f0ff4f1c3b35435cbcb3090d031fbdc5796 /lib
parent1543101e2cc0b124df8031d3a5b003280b5ce253 (diff)
downloadperl6-matrix-client-e69b990cf4ac80adac0496d988717b49f41547d0.tar.gz
Return '' if there's no m.room.name event for that room
See issue #13 in github.
Diffstat (limited to 'lib')
-rw-r--r--lib/Matrix/Client/Room.pm68
1 files changed, 8 insertions, 0 deletions
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<name>;
}