We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please complete the following information:
Describe the Bug: response that used Sandwich always failed, with exception like above
Expected Behavior: Response should be success because implementation without Sandwich had no problem
Implementation:
@GET("api/v3/rekening/detail") suspend fun getRekeningDetail( @Header("Authorization") auth: String, @Query("id") id: String, @Query("type") type: String ): ApiResponse<ResponseResult<Rekening>> data class ResponseResult<T>( @field:SerializedName("data") val data: T? = null, @field:SerializedName("message") val message: String? = null, @field:SerializedName("status") val status: Int? = null ) fun getRekeningById(rekeningId: String, rekeningType: RekeningType) = flow { emit(State.Single.Loading()) var rekeningData: Rekening? = null if (NetworkUtils.isConnected()) { val response = service.getRekeningDetail( mSecuredPreferences.accessToken, rekeningId, rekeningType.value ) response.suspendOnSuccess { dao.insertSyncData(listOf(data.data)) rekeningData = dao.getRekeningById(rekeningId) }.suspendOnError { rekeningData = dao.getRekeningById(rekeningId) }.suspendOnException { rekeningData = dao.getRekeningById(rekeningId) } } else { rekeningData = dao.getRekeningById(rekeningId) } emit(State.Single.Success(rekeningData)) }.flowOn(Dispatchers.IO)
The text was updated successfully, but these errors were encountered:
Hi, Could you share your Retrofit Builder?
Sorry, something went wrong.
If you don't use the CoroutinesResponseCallAdapterFactory or use it with another factory, RuntimeException will happen.
CoroutinesResponseCallAdapterFactory
RuntimeException
this is my retrofit builder
val retrofit: Retrofit = Retrofit.Builder() .baseUrl(Secured.getBaseUrlApi(isBareksa)) .client(okHttpClient) .addCallAdapterFactory(CoroutineCallAdapterFactory()) .addConverterFactory(ScalarsConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build()
ooh, I think this is the problem I thought it was the same as CoroutineCallAdapterFactory
Sorry, my bad it's fixed now
Thank you for fast response
No branches or pull requests
Please complete the following information:
Describe the Bug:
response that used Sandwich always failed, with exception like above
Expected Behavior:
Response should be success because implementation without Sandwich had no problem
Implementation:
The text was updated successfully, but these errors were encountered: