Search in sources :

Example 1 with NetworkExeption

use of com.shizhefei.mvc.http.NetworkExeption in project MVCHelper by LuckyJayce.

the class MeizhiParser method parseImp.

protected DATA parseImp(Response response) throws Exception {
    if (response.isSuccessful()) {
        String json = response.body().string();
        JSONObject jsonObject = new JSONObject(json);
        boolean error = jsonObject.getBoolean("error");
        if (!error) {
            String result = jsonObject.getString("results");
            DATA data = new JsonParser<DATA>(getClass()) {
            }.parse(result);
            return data;
        }
        throw new BizException();
    }
    throw new NetworkExeption(response);
}
Also used : JSONObject(org.json.JSONObject) BizException(com.shizhefei.test.models.exception.BizException) NetworkExeption(com.shizhefei.mvc.http.NetworkExeption)

Aggregations

NetworkExeption (com.shizhefei.mvc.http.NetworkExeption)1 BizException (com.shizhefei.test.models.exception.BizException)1 JSONObject (org.json.JSONObject)1