// Path: app/src/main/java/com/hhxplaying/neteasedemo/netease/config/ErrorCode.java
// public class ErrorCode {
//     public static final String TAG = "ErrorCode";
//     public static HashMap<Integer, String> errorCodeMap = new HashMap<>();
//     static {
//         errorCodeMap.put(0,  "服务器无响应");
//         errorCodeMap.put(-7, "网络超时，请检查您的网络");
//         errorCodeMap.put(-1, "网络错误，请检查您的网络");
//         errorCodeMap.put(-2, "服务器错误");
//         errorCodeMap.put(-3, "非法参数");
//         errorCodeMap.put(-8, "非法解析错误");
//         errorCodeMap.put(-4, "解析异常");
//         errorCodeMap.put(-5, "解析数字异常");
//         errorCodeMap.put(-6, "授权异常");
//     }
// }


import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkError;
import com.android.volley.NetworkResponse;
import com.android.volley.NoConnectionError;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.hhxplaying.neteasedemo.netease.config.ErrorCode;
import java.util.HashMap;
import java.util.Map;

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    class DefaultErrorListener implements Response.ErrorListener {
        private Context contextHold;
        public DefaultErrorListener(Context context) {
            contextHold = context;
        }
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
            Log.d("RVA", "error:" + error);

            int errorCode = 0;
            if (error instanceof TimeoutError) {
                errorCode = -7;
            } else if (error instanceof NoConnectionError) {
                errorCode = -1;
            } else if (error instanceof AuthFailureError) {
                errorCode = -6;
            } else if (error instanceof ServerError) {
                errorCode = 0;
            } else if (error instanceof NetworkError) {
                errorCode = -1;
            } else if (error instanceof ParseError) {
                errorCode = -8;
            }
// Path: app/src/main/java/com/hhxplaying/neteasedemo/netease/config/ErrorCode.java
// public class ErrorCode {
//     public static final String TAG = "ErrorCode";
//     public static HashMap<Integer, String> errorCodeMap = new HashMap<>();
//     static {
//         errorCodeMap.put(0,  "服务器无响应");
//         errorCodeMap.put(-7, "网络超时，请检查您的网络");
//         errorCodeMap.put(-1, "网络错误，请检查您的网络");
//         errorCodeMap.put(-2, "服务器错误");
//         errorCodeMap.put(-3, "非法参数");
//         errorCodeMap.put(-8, "非法解析错误");
//         errorCodeMap.put(-4, "解析异常");
//         errorCodeMap.put(-5, "解析数字异常");
//         errorCodeMap.put(-6, "授权异常");
//     }
// }


// Path: app/src/main/java/com/hhxplaying/neteasedemo/netease/factory/RequestSingletonFactory.java
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkError;
import com.android.volley.NetworkResponse;
import com.android.volley.NoConnectionError;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.ServerError;
import com.android.volley.TimeoutError;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.hhxplaying.neteasedemo.netease.config.ErrorCode;
import java.util.HashMap;
import java.util.Map;


        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    class DefaultErrorListener implements Response.ErrorListener {
        private Context contextHold;
        public DefaultErrorListener(Context context) {
            contextHold = context;
        }
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
            Log.d("RVA", "error:" + error);

            int errorCode = 0;
            if (error instanceof TimeoutError) {
                errorCode = -7;
            } else if (error instanceof NoConnectionError) {
                errorCode = -1;
            } else if (error instanceof AuthFailureError) {
                errorCode = -6;
            } else if (error instanceof ServerError) {
                errorCode = 0;
            } else if (error instanceof NetworkError) {
                errorCode = -1;
            } else if (error instanceof ParseError) {
                errorCode = -8;
            }
            Toast.makeText(contextHold, ErrorCode.errorCodeMap.get(errorCode), Toast.LENGTH_SHORT).show();