Java 类com.facebook.internal.FacebookRequestErrorClassification 实例源码

项目:kognitivo    文件:FacebookRequestError.java   
private FacebookRequestError(
        int requestStatusCode,
        int errorCode,
        int subErrorCode,
        String errorType,
        String errorMessage,
        String errorUserTitle,
        String errorUserMessage,
        boolean errorIsTransient,
        JSONObject requestResultBody,
        JSONObject requestResult,
        Object batchRequestResult,
        HttpURLConnection connection,
        FacebookException exception) {
    this.requestStatusCode = requestStatusCode;
    this.errorCode = errorCode;
    this.subErrorCode = subErrorCode;
    this.errorType = errorType;
    this.errorMessage = errorMessage;
    this.requestResultBody = requestResultBody;
    this.requestResult = requestResult;
    this.batchRequestResult = batchRequestResult;
    this.connection = connection;
    this.errorUserTitle = errorUserTitle;
    this.errorUserMessage = errorUserMessage;

    boolean isLocalException = false;
    if (exception != null) {
        this.exception = exception;
        isLocalException =  true;
    } else {
        this.exception = new FacebookServiceException(this, errorMessage);
    }

    FacebookRequestErrorClassification errorClassification = getErrorClassification();
    this.category = isLocalException
            ? Category.OTHER
            : errorClassification.classify(errorCode, subErrorCode, errorIsTransient);
    this.errorRecoveryMessage = errorClassification.getRecoveryMessage(this.category);
}
项目:kognitivo    文件:FacebookRequestError.java   
static synchronized FacebookRequestErrorClassification getErrorClassification() {
    FacebookRequestErrorClassification errorClassification;
    Utility.FetchedAppSettings appSettings =
            Utility.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
    if (appSettings == null) {
        return FacebookRequestErrorClassification.getDefaultErrorClassification();
    }
    return appSettings.getErrorClassification();
}
项目:Move-Alarm_ORCA    文件:FacebookRequestError.java   
private FacebookRequestError(
        int requestStatusCode,
        int errorCode,
        int subErrorCode,
        String errorType,
        String errorMessage,
        String errorUserTitle,
        String errorUserMessage,
        boolean errorIsTransient,
        JSONObject requestResultBody,
        JSONObject requestResult,
        Object batchRequestResult,
        HttpURLConnection connection,
        FacebookException exception) {
    this.requestStatusCode = requestStatusCode;
    this.errorCode = errorCode;
    this.subErrorCode = subErrorCode;
    this.errorType = errorType;
    this.errorMessage = errorMessage;
    this.requestResultBody = requestResultBody;
    this.requestResult = requestResult;
    this.batchRequestResult = batchRequestResult;
    this.connection = connection;
    this.errorUserTitle = errorUserTitle;
    this.errorUserMessage = errorUserMessage;

    boolean isLocalException = false;
    if (exception != null) {
        this.exception = exception;
        isLocalException =  true;
    } else {
        this.exception = new FacebookServiceException(this, errorMessage);
    }

    FacebookRequestErrorClassification errorClassification = getErrorClassification();
    this.category = isLocalException
            ? Category.OTHER
            : errorClassification.classify(errorCode, subErrorCode, errorIsTransient);
    this.errorRecoveryMessage = errorClassification.getRecoveryMessage(this.category);
}
项目:Move-Alarm_ORCA    文件:FacebookRequestError.java   
static synchronized FacebookRequestErrorClassification getErrorClassification() {
    FacebookRequestErrorClassification errorClassification;
    Utility.FetchedAppSettings appSettings =
            Utility.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
    if (appSettings == null) {
        return FacebookRequestErrorClassification.getDefaultErrorClassification();
    }
    return appSettings.getErrorClassification();
}
项目:SocioBlood    文件:FacebookRequestError.java   
private FacebookRequestError(
        int requestStatusCode,
        int errorCode,
        int subErrorCode,
        String errorType,
        String errorMessage,
        String errorUserTitle,
        String errorUserMessage,
        boolean errorIsTransient,
        JSONObject requestResultBody,
        JSONObject requestResult,
        Object batchRequestResult,
        HttpURLConnection connection,
        FacebookException exception) {
    this.requestStatusCode = requestStatusCode;
    this.errorCode = errorCode;
    this.subErrorCode = subErrorCode;
    this.errorType = errorType;
    this.errorMessage = errorMessage;
    this.requestResultBody = requestResultBody;
    this.requestResult = requestResult;
    this.batchRequestResult = batchRequestResult;
    this.connection = connection;
    this.errorUserTitle = errorUserTitle;
    this.errorUserMessage = errorUserMessage;

    boolean isLocalException = false;
    if (exception != null) {
        this.exception = exception;
        isLocalException =  true;
    } else {
        this.exception = new FacebookServiceException(this, errorMessage);
    }

    FacebookRequestErrorClassification errorClassification = getErrorClassification();
    this.category = isLocalException
            ? Category.OTHER
            : errorClassification.classify(errorCode, subErrorCode, errorIsTransient);
    this.errorRecoveryMessage = errorClassification.getRecoveryMessage(this.category);
}
项目:SocioBlood    文件:FacebookRequestError.java   
static synchronized FacebookRequestErrorClassification getErrorClassification() {
    FacebookRequestErrorClassification errorClassification;
    Utility.FetchedAppSettings appSettings =
            Utility.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
    if (appSettings == null) {
        return FacebookRequestErrorClassification.getDefaultErrorClassification();
    }
    return appSettings.getErrorClassification();
}
项目:kognitivo    文件:GraphResponse.java   
private static GraphResponse createResponseFromObject(
        GraphRequest request,
        HttpURLConnection connection,
        Object object,
        Object originalResult
) throws JSONException {
    if (object instanceof JSONObject) {
        JSONObject jsonObject = (JSONObject) object;

        FacebookRequestError error =
                FacebookRequestError.checkResponseAndCreateError(
                        jsonObject,
                        originalResult,
                        connection);
        if (error != null) {
            if (error.getErrorCode() == FacebookRequestErrorClassification.EC_INVALID_TOKEN
                    && Utility.isCurrentAccessToken(request.getAccessToken())) {
                AccessToken.setCurrentAccessToken(null);
            }
            return new GraphResponse(request, connection, error);
        }

        Object body = Utility.getStringPropertyAsJSON(
                jsonObject,
                BODY_KEY,
                NON_JSON_RESPONSE_PROPERTY);

        if (body instanceof JSONObject) {
            return new GraphResponse(request, connection, body.toString(), (JSONObject)body);
        } else if (body instanceof JSONArray) {
            return new GraphResponse(request, connection, body.toString(), (JSONArray)body);
        }
        // We didn't get a body we understand how to handle, so pretend we got nothing.
        object = JSONObject.NULL;
    }

    if (object == JSONObject.NULL) {
        return new GraphResponse(request, connection, object.toString(), (JSONObject)null);
    } else {
        throw new FacebookException("Got unexpected object type in response, class: "
                + object.getClass().getSimpleName());
    }
}
项目:Move-Alarm_ORCA    文件:GraphResponse.java   
private static GraphResponse createResponseFromObject(
        GraphRequest request,
        HttpURLConnection connection,
        Object object,
        Object originalResult
) throws JSONException {
    if (object instanceof JSONObject) {
        JSONObject jsonObject = (JSONObject) object;

        FacebookRequestError error =
                FacebookRequestError.checkResponseAndCreateError(
                        jsonObject,
                        originalResult,
                        connection);
        if (error != null) {
            if (error.getErrorCode() == FacebookRequestErrorClassification.EC_INVALID_TOKEN
                    && Utility.isCurrentAccessToken(request.getAccessToken())) {
                AccessToken.setCurrentAccessToken(null);
            }
            return new GraphResponse(request, connection, error);
        }

        Object body = Utility.getStringPropertyAsJSON(
                jsonObject,
                BODY_KEY,
                NON_JSON_RESPONSE_PROPERTY);

        if (body instanceof JSONObject) {
            return new GraphResponse(request, connection, body.toString(), (JSONObject)body);
        } else if (body instanceof JSONArray) {
            return new GraphResponse(request, connection, body.toString(), (JSONArray)body);
        }
        // We didn't get a body we understand how to handle, so pretend we got nothing.
        object = JSONObject.NULL;
    }

    if (object == JSONObject.NULL) {
        return new GraphResponse(request, connection, object.toString(), (JSONObject)null);
    } else {
        throw new FacebookException("Got unexpected object type in response, class: "
                + object.getClass().getSimpleName());
    }
}
项目:SocioBlood    文件:GraphResponse.java   
private static GraphResponse createResponseFromObject(
        GraphRequest request,
        HttpURLConnection connection,
        Object object,
        Object originalResult
) throws JSONException {
    if (object instanceof JSONObject) {
        JSONObject jsonObject = (JSONObject) object;

        FacebookRequestError error =
                FacebookRequestError.checkResponseAndCreateError(
                        jsonObject,
                        originalResult,
                        connection);
        if (error != null) {
            if (error.getErrorCode() == FacebookRequestErrorClassification.EC_INVALID_TOKEN
                    && Utility.isCurrentAccessToken(request.getAccessToken())) {
                AccessToken.setCurrentAccessToken(null);
            }
            return new GraphResponse(request, connection, error);
        }

        Object body = Utility.getStringPropertyAsJSON(
                jsonObject,
                BODY_KEY,
                NON_JSON_RESPONSE_PROPERTY);

        if (body instanceof JSONObject) {
            return new GraphResponse(request, connection, body.toString(), (JSONObject)body);
        } else if (body instanceof JSONArray) {
            return new GraphResponse(request, connection, body.toString(), (JSONArray)body);
        }
        // We didn't get a body we understand how to handle, so pretend we got nothing.
        object = JSONObject.NULL;
    }

    if (object == JSONObject.NULL) {
        return new GraphResponse(request, connection, object.toString(), (JSONObject)null);
    } else {
        throw new FacebookException("Got unexpected object type in response, class: "
                + object.getClass().getSimpleName());
    }
}