All Downloads are FREE. Search and download functionalities are using the official Maven repository.

app.cybrid.cybrid_api_id.client.infrastructure.ResponseExt.kt Maven / Gradle / Ivy

There is a newer version: 0.122.72
Show newest version
package app.cybrid.cybrid_api_id.client.infrastructure

import com.google.gson.GsonBuilder
import com.google.gson.JsonParseException
import retrofit2.Response

@Throws(JsonParseException::class)
inline fun  Response<*>.getErrorResponse(serializerBuilder: GsonBuilder = Serializer.gsonBuilder): T? {
    val serializer = serializerBuilder.create()
    val reader = errorBody()?.charStream()
    if (reader != null) {
        return serializer.fromJson(reader, T::class.java)
    }
    return null
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy