From 745c52c7d765c4c7007f949e13b1534e82b2907a Mon Sep 17 00:00:00 2001 From: untidylamp <44341286+untidylamp@users.noreply.github.com> Date: Wed, 5 Dec 2018 18:14:14 -0500 Subject: [PATCH] Catch sms to Matrix errors Catch errors when sending messages to Matrix --- .../java/eu/droogers/smsmatrix/Matrix.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/droogers/smsmatrix/Matrix.java b/app/src/main/java/eu/droogers/smsmatrix/Matrix.java index 321cbbf..81ab715 100644 --- a/app/src/main/java/eu/droogers/smsmatrix/Matrix.java +++ b/app/src/main/java/eu/droogers/smsmatrix/Matrix.java @@ -248,7 +248,24 @@ public class Matrix { Message msg = new Message(); msg.body = body; msg.msgtype = type; - session.getRoomsApiClient().sendMessage(String.valueOf(transaction), room.getRoomId(), msg, new SimpleApiCallback()); + session.getRoomsApiClient().sendMessage(String.valueOf(transaction), room.getRoomId(), msg, new SimpleApiCallback() { + @Override + public void onSuccess(Event event) { + Log.i(TAG, "sendMessage success"); + } + @Override + public void onMatrixError(MatrixError e) { + Log.e(TAG, "sendMessage MatrixError" + e); + } + @Override + public void onNetworkError(Exception e) { + Log.e(TAG, "sendMessage Network error" + e); + } + @Override + public void onUnexpectedError(Exception e) { + Log.e(TAG, "sendMessage Unexpected error" + e); + } + }); transaction++; }