package com.mints.library.net;

import retrofit2.adapter.rxjava.HttpException;

/**
 * 描述：NetCommon
 * 作者：孟崔广
 * 时间：2018/1/10 17:51
 * 邮箱：mengcga@163.com
 */
public class NetCommon {

    /**
     * 网络请求错误码
     *
     * @param error
     * @return
     */
    public static int httpErrorCode(Throwable error) {
        int httpErrorCode = 0;
        if (error instanceof HttpException) {
            httpErrorCode = ((HttpException) error).code();
        }
        return httpErrorCode;
    }

}
