From fea52b777f1e862f778dbbddb679e80d2e1af95c Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 12 Jun 2019 13:54:04 +0200 Subject: [PATCH] Return error on startDirectChat error --- lib/src/User.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/User.dart b/lib/src/User.dart index bb3e782..94cf065 100644 --- a/lib/src/User.dart +++ b/lib/src/User.dart @@ -125,8 +125,9 @@ class User { return res; } - /// Returns an existing direct chat with this user or creates a new one. - Future startDirectChat() async { + /// Returns an existing direct chat ID with this user or creates a new one. + /// May return ErrorResponse on error. + Future startDirectChat() async { // Try to find an existing direct chat String roomID = await room.client?.store.getDirectChatRoomID(id); if (roomID != null) return roomID; @@ -139,7 +140,7 @@ class User { "preset": "trusted_private_chat" }); - if (resp is ErrorResponse || resp["room_id"] == null) return null; + if (resp is ErrorResponse || resp["room_id"] == null) return resp; final String newRoomID = resp["room_id"];