package com.common.lib_base.common.http.exception;

/**
 * Created by admin on 2018/3/15.
 *
 * @version $Rev$
 * @time 2018/3/15 21:37
 * @des ${TODO}
 * @updateAuthor $Author$
 * @updateDate $Date$
 * @updateDes ${TODO}
 */

public class BaseException extends Exception {


    /*API错误*/
    public static final String API_ERROR = "0x0";

    /*网络错误*/
    public static final String NETWORD_ERROR = "0x1";
    /*http_错误*/
    public static final String HTTP_ERROR = "0x2";
    /*json错误*/
    public static final String JSON_ERROR = "0x3";
    /*未知错误---一般是服务器返回的json数据不对，或者是返回了true，但data出错，如为null*/
    public static final String UNKNOWN_ERROR = "0x4";
    /*运行时异常-包含自定义异常*/
    public static final String RUNTIME_ERROR = "0x5";
    /*无法解析该域名*/
    public static final String UNKOWNHOST_ERROR = "0x6";

    /*连接网络超时*/
    public static final String SOCKET_TIMEOUT_ERROR = "0x7";

    /*无网络连接*/
    public static final String SOCKET_ERROR = "0x8";




    //    api /////////////////////////////////////////

    // 服务器错误
    public static final String ERROR_API_SYSTEM="10000";

    // 登录错误，用户名密码错误
//    public static final String  ERROR_API_LOGIN="101";

    //调用无权限的API
    public static final String ERROR_API_NO_PERMISSION="10002";

    //账户被冻结
    public static final String ERROR_API_ACCOUNT_FREEZE="10003";



    /**
     * token失效
     * 根据公司的后台同事定义
     */
    public static final String ERROR_TOKEN="100003";



    // http

    public static final String ERROR_HTTP_400="400";

    public static final String ERROR_HTTP_404="404";

    public static final String ERROR_HTTP_405="405";

    public static final String ERROR_HTTP_500="500";


    private String code;

    private String dispalyMessage;

    public BaseException() {
    }

    public BaseException(String code, String dispalyMessage) {
        this.code = code;
        this.dispalyMessage = dispalyMessage;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDispalyMessage() {
        return dispalyMessage;
    }

    public void setDispalyMessage(String dispalyMessage) {
        this.dispalyMessage = dispalyMessage;
    }
}
