Search in sources :

Example 1 with FacebookRequestErrorClassification

use of com.facebook.internal.FacebookRequestErrorClassification in project facebook-android-sdk by facebook.

the class FacebookRequestError method getErrorClassification.

static synchronized FacebookRequestErrorClassification getErrorClassification() {
    FacebookRequestErrorClassification errorClassification;
    FetchedAppSettings appSettings = FetchedAppSettingsManager.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
    if (appSettings == null) {
        return FacebookRequestErrorClassification.getDefaultErrorClassification();
    }
    return appSettings.getErrorClassification();
}
Also used : FetchedAppSettings(com.facebook.internal.FetchedAppSettings) FacebookRequestErrorClassification(com.facebook.internal.FacebookRequestErrorClassification)

Example 2 with FacebookRequestErrorClassification

use of com.facebook.internal.FacebookRequestErrorClassification in project facebook-android-sdk by facebook.

the class ErrorClassificationTest method testDefaultErrorClassification.

@Test
public void testDefaultErrorClassification() {
    FacebookRequestErrorClassification errorClassification = FacebookRequestErrorClassification.getDefaultErrorClassification();
    // Test transient takes precedence
    assertEquals(FacebookRequestError.Category.TRANSIENT, errorClassification.classify(FacebookRequestErrorClassification.EC_INVALID_TOKEN, 0, true));
    assertEquals(FacebookRequestError.Category.LOGIN_RECOVERABLE, errorClassification.classify(FacebookRequestErrorClassification.EC_INVALID_SESSION, 0, false));
    assertEquals(FacebookRequestError.Category.LOGIN_RECOVERABLE, errorClassification.classify(FacebookRequestErrorClassification.EC_INVALID_TOKEN, 0, false));
    assertEquals(FacebookRequestError.Category.TRANSIENT, errorClassification.classify(FacebookRequestErrorClassification.EC_SERVICE_UNAVAILABLE, 0, false));
    assertEquals(FacebookRequestError.Category.TRANSIENT, errorClassification.classify(FacebookRequestErrorClassification.EC_APP_TOO_MANY_CALLS, 0, false));
    assertEquals(FacebookRequestError.Category.TRANSIENT, errorClassification.classify(FacebookRequestErrorClassification.EC_RATE, 0, false));
    assertEquals(FacebookRequestError.Category.TRANSIENT, errorClassification.classify(FacebookRequestErrorClassification.EC_USER_TOO_MANY_CALLS, 0, false));
    assertEquals(FacebookRequestError.Category.TRANSIENT, errorClassification.classify(FacebookRequestErrorClassification.EC_TOO_MANY_USER_ACTION_CALLS, 0, false));
}
Also used : FacebookRequestErrorClassification(com.facebook.internal.FacebookRequestErrorClassification) Test(org.junit.Test)

Aggregations

FacebookRequestErrorClassification (com.facebook.internal.FacebookRequestErrorClassification)2 FetchedAppSettings (com.facebook.internal.FetchedAppSettings)1 Test (org.junit.Test)1