mirror of
https://github.com/tijder/SmsMatrix.git
synced 2024-10-27 18:24:01 +00:00
Catch matrix login errors (#39)
* catch Matrix onLogin errors Catch Matrix errors login and network errors * Catch sms to Matrix errors Catch errors when sending messages to Matrix
This commit is contained in:
parent
6fab08d956
commit
1cb24704be
@ -28,6 +28,7 @@ import org.matrix.androidsdk.listeners.MXMediaUploadListener;
|
|||||||
import org.matrix.androidsdk.rest.callback.SimpleApiCallback;
|
import org.matrix.androidsdk.rest.callback.SimpleApiCallback;
|
||||||
import org.matrix.androidsdk.rest.client.LoginRestClient;
|
import org.matrix.androidsdk.rest.client.LoginRestClient;
|
||||||
import org.matrix.androidsdk.rest.model.Event;
|
import org.matrix.androidsdk.rest.model.Event;
|
||||||
|
import org.matrix.androidsdk.rest.model.MatrixError;
|
||||||
import org.matrix.androidsdk.rest.model.Message;
|
import org.matrix.androidsdk.rest.model.Message;
|
||||||
import org.matrix.androidsdk.rest.model.login.Credentials;
|
import org.matrix.androidsdk.rest.model.login.Credentials;
|
||||||
|
|
||||||
@ -90,6 +91,21 @@ public class Matrix {
|
|||||||
super.onSuccess(credentials);
|
super.onSuccess(credentials);
|
||||||
onLogin(credentials);
|
onLogin(credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMatrixError(MatrixError e) {
|
||||||
|
Log.e(TAG, "onLogin MatrixError" + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNetworkError(Exception e) {
|
||||||
|
Log.e(TAG, "onLogin Network error" + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnexpectedError(Exception e) {
|
||||||
|
Log.e(TAG, "onLogin Unexpected error" + e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +248,24 @@ public class Matrix {
|
|||||||
Message msg = new Message();
|
Message msg = new Message();
|
||||||
msg.body = body;
|
msg.body = body;
|
||||||
msg.msgtype = type;
|
msg.msgtype = type;
|
||||||
session.getRoomsApiClient().sendMessage(String.valueOf(transaction), room.getRoomId(), msg, new SimpleApiCallback<Event>());
|
session.getRoomsApiClient().sendMessage(String.valueOf(transaction), room.getRoomId(), msg, new SimpleApiCallback<Event>() {
|
||||||
|
@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++;
|
transaction++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user