Search in sources :

Example 1 with HttpException

use of com.benmu.framework.http.okhttp.exception.HttpException in project WeexErosFramework by bmfe.

the class EventFetch method parseError.

private void parseError(Context context, Exception e, JSCallback callback) {
    if (e instanceof CancelException) {
        // request canceled
        ModalManager.BmLoading.dismissLoading(context);
        return;
    }
    AxiosResultBean bean = new AxiosResultBean();
    if (e instanceof HttpException) {
        HttpException httpException = (HttpException) e;
        bean.status = httpException.getmErrorCode();
        bean.errorMsg = httpException.getmErrorMessage();
    } else if (e instanceof IrregularUrlException) {
        IrregularUrlException irregularUrlException = (IrregularUrlException) e;
        bean.status = 9;
        bean.errorMsg = irregularUrlException.getmErrosMeeage();
    }
    if (callback != null) {
        callback.invoke(bean);
    }
}
Also used : AxiosResultBean(com.benmu.framework.model.AxiosResultBean) IrregularUrlException(com.benmu.framework.http.okhttp.exception.IrregularUrlException) HttpException(com.benmu.framework.http.okhttp.exception.HttpException) CancelException(com.benmu.framework.http.okhttp.exception.CancelException)

Aggregations

CancelException (com.benmu.framework.http.okhttp.exception.CancelException)1 HttpException (com.benmu.framework.http.okhttp.exception.HttpException)1 IrregularUrlException (com.benmu.framework.http.okhttp.exception.IrregularUrlException)1 AxiosResultBean (com.benmu.framework.model.AxiosResultBean)1