Code example for JSONObject

Methods: optInt, optString

0
     * @param engageToken the Engage auth_info token in the request precipitating this error, if any 
     * @param conflictingProvider for merge errors, the identity provider in the request precipitating this 
     *                            error. 
     */ 
    /*package*/ CaptureApiError(JSONObject response, String engageToken, String conflictingProvider) {
        code = response.optInt("code");
        error = response.optString("error");
        error_description = response.optString("error_description");
        raw_response = response;
        this.engageToken = engageToken;
        this.conflictingIdentityProvider = conflictingProvider;
    } 
 
    public boolean isInvalidApiResponse() { 
        return this == INVALID_API_RESPONSE;
    } 
 
    /** 
     * @return a human readable (but not end-user facing, and not localized) version of this error 
     */ 
    public String toString() {