Search in sources :

Example 1 with SentryEvent

use of io.sentry.core.SentryEvent in project pod-chat-android-sdk by FanapSoft.

the class ChatCore method captureError.

@NonNull
protected String captureError(String errorMessage, long errorCode, String uniqueId, Throwable throwable) {
    ErrorOutPut error = new ErrorOutPut(true, errorMessage, errorCode, uniqueId);
    String jsonError = gson.toJson(error);
    listenerManager.callOnError(jsonError, error);
    showErrorLog(jsonError);
    if (sentryLog) {
        SentryEvent event = new SentryEvent(throwable);
        event.setEnvironment("PODCHAT");
        event.setLevel(SentryLevel.ERROR);
        event.setTag("FROM_SDK", "PODCHAT");
        event.setExtra("CACHE ENABLED", " >>> " + cache);
        Sentry.captureEvent(event, new PodChatException(errorMessage, uniqueId, getToken()));
    }
    if (log) {
        Log.e(TAG, "ErrorMessage: " + errorMessage + " *Code* " + errorCode + " *uniqueId* " + uniqueId);
    }
    return jsonError;
}
Also used : PodChatException(com.fanap.podchat.util.PodChatException) SentryEvent(io.sentry.core.SentryEvent) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) NonNull(android.support.annotation.NonNull)

Example 2 with SentryEvent

use of io.sentry.core.SentryEvent in project pod-chat-android-sdk by FanapSoft.

the class ChatCore method captureError.

@NonNull
private String captureError(String errorMessage, long errorCode, String uniqueId) {
    ErrorOutPut error = new ErrorOutPut(true, errorMessage, errorCode, uniqueId);
    String jsonError = gson.toJson(error);
    listenerManager.callOnError(jsonError, error);
    showErrorLog(jsonError);
    if (errorCode != ChatConstant.ERROR_CODE_CHAT_READY && errorCode != 21) {
        if (sentryLog) {
            SentryEvent event = new SentryEvent(new PodChatException(errorMessage, uniqueId, getToken()));
            event.setEnvironment("PODCHAT");
            event.setLevel(SentryLevel.ERROR);
            event.setTag("FROM_SDK", "PODCHAT");
            event.setExtra("CACHE ENABLED", " >>> " + cache);
            Sentry.captureEvent(event, error);
        }
    }
    if (log) {
        Log.e(TAG, "ErrorMessage: " + errorMessage + " *Code* " + errorCode + " *uniqueId* " + uniqueId);
    }
    return jsonError;
}
Also used : PodChatException(com.fanap.podchat.util.PodChatException) SentryEvent(io.sentry.core.SentryEvent) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut) NonNull(android.support.annotation.NonNull)

Example 3 with SentryEvent

use of io.sentry.core.SentryEvent in project pod-chat-android-sdk by FanapSoft.

the class ChatCore method captureError.

protected String captureError(PodChatException exception) {
    ErrorOutPut error = new ErrorOutPut(true, exception.getMessage(), exception.getCode(), exception.getUniqueId());
    String jsonError = gson.toJson(error);
    listenerManager.callOnError(jsonError, error);
    showErrorLog(jsonError);
    if (sentryLog) {
        SentryEvent event = new SentryEvent(exception);
        event.setEnvironment("PODCHAT");
        event.setLevel(SentryLevel.ERROR);
        event.setTag("FROM_SDK", "PODCHAT");
        event.setExtra("CACHE ENABLED", " >>> " + cache);
        Sentry.captureEvent(event, error);
    }
    return jsonError;
}
Also used : SentryEvent(io.sentry.core.SentryEvent) ErrorOutPut(com.fanap.podchat.model.ErrorOutPut)

Aggregations

ErrorOutPut (com.fanap.podchat.model.ErrorOutPut)3 SentryEvent (io.sentry.core.SentryEvent)3 NonNull (android.support.annotation.NonNull)2 PodChatException (com.fanap.podchat.util.PodChatException)2