use of com.fanap.podchat.model.Error in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method handleError.
private void handleError(ChatMessage chatMessage) {
Error error = gson.fromJson(chatMessage.getContent(), Error.class);
if (error.getCode() == 401) {
pingHandler.removeCallbacksAndMessages(null);
} else if (error.getCode() == 21) {
userInfoResponse = true;
retryStepUserInfo = 1;
chatReady = false;
tokenHandler.removeCallbacksAndMessages(null);
String errorMessage = error.getMessage();
long errorCode = error.getCode();
captureError(errorMessage, errorCode, chatMessage.getUniqueId());
pingHandler.removeCallbacksAndMessages(null);
stopTyping();
/*we are Changing the state of the chat because of the Client is not Authenticate*/
listenerManager.callOnChatState("ASYNC_READY");
return;
}
String errorMessage = error.getMessage();
long errorCode = error.getCode();
if (PodNotificationManager.isNotificationError(chatMessage, error, context, getUserId()))
return;
ThreadManager.onError(chatMessage);
captureError(errorMessage, errorCode, chatMessage.getUniqueId());
}
use of com.fanap.podchat.model.Error in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method reformatError.
@NonNull
private String reformatError(boolean hasError, ChatMessage chatMessage, OutPutHistory outPut) {
Error error = gson.fromJson(chatMessage.getContent(), Error.class);
Log.e("RECEIVED_ERROR", chatMessage.getContent());
Log.e("ErrorMessage", error.getMessage());
Log.e("ErrorCode", String.valueOf(error.getCode()));
outPut.setHasError(hasError);
outPut.setErrorMessage(error.getMessage());
outPut.setErrorCode(error.getCode());
return gson.toJson(outPut);
}