AnalyticsAPICallsUtils.java
1014 Bytes
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.commons.json.JSONException
* org.apache.sling.commons.json.JSONObject
*/
package com.day.cq.analytics.sitecatalyst.impl.util;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.JSONObject;
public class AnalyticsAPICallsUtils {
private AnalyticsAPICallsUtils() {
}
public static String getErrorMessageFromResponse(String response) throws JSONException {
if (response.indexOf("{") == 0) {
JSONObject o = new JSONObject(response);
if (o.has("error")) {
String error = o.getString("error");
if (o.has("error_description")) {
error = error + ". " + o.optString("error_description");
}
return error;
}
if (o.has("errors")) {
return o.getString("errors");
}
}
return null;
}
}