-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
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
Fail State call twice and make error #680
Comments
It's impossible to help here without more context. Can you reproduce this in another project? What does |
@gpeal handleErrorBe is a function for Parce my api error message fun handleErrorBE(error: Throwable): Throwable {
val message = safeLaunchWithResult(error.message.orEmpty()) {
val response = (error as? HttpException)?.response()?.errorBody()?.string()
val gson = Gson().fromJson(response, ErrorResponse::class.java)
gson.apiDisplayMessage.orEmpty()
}
return Throwable(message)
} inline fun <reified T> safeLaunchWithResult(default: T, block: () -> T): T = try {
block()
} catch (e: Exception) {
e.printStackTrace()
default
} and return an error message to Fail Message for the state I use retrofit 2.9.0 for network connection and implement Kotlin delegation and jetpack compose i try at same project with this code val requestBody: RequestBody = builder.build()
logD<PemilihEditViewModel>("state begin")
suspend {
pemilihUseCase.updatePemilih(state.pemilihDetailDto?.id.toString(), requestBody)
}.execute(Dispatchers.IO) {
logD<PemilihEditViewModel>("state $it")
copy(pemilihEditDtoAsyn = it)
} and the output is @PUT("pemilih/{id}")
suspen fun updatePemilih(
@Path("id") id: String,
@Body file: RequestBody
): BaseResponse<PemilihAddResponse> |
i want changes error message Fail state whit this
but this make an error
this error cause Fail state call twice when i see log output, then the last output message null
when i implement like this
this works perfectly. when I use a function from Mavericks, it makes an error.
The text was updated successfully, but these errors were encountered: