package com.gh.gamecenter.common.retrofit

import com.lightgame.utils.Utils
import io.reactivex.functions.BiConsumer

/**
 * 不需要使用请求成功后返回的数据，也不对请求异常进行处理的请求可以用这个 [EmptyResponse]
 */
class EmptyResponse<T> : BiConsumer<T, Throwable> {

    override fun accept(t: T?, throwable: Throwable?) {
        if (t != null) {
            Utils.log(t)
            return
        }

        if (throwable != null) {
            throwable.printStackTrace()
        } else {
            Utils.log("Something serious has happened!")
        }
    }

}