mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
throw Failure instead of meaning less IOException
This commit is contained in:
parent
4c04014e4d
commit
f3039601bf
1 changed files with 2 additions and 1 deletions
|
@ -22,6 +22,7 @@ import com.squareup.moshi.Moshi
|
|||
import im.vector.matrix.android.api.auth.data.SessionParams
|
||||
import im.vector.matrix.android.internal.di.Authenticated
|
||||
import im.vector.matrix.android.internal.network.ProgressRequestBody
|
||||
import im.vector.matrix.android.internal.network.toFailure
|
||||
import okhttp3.*
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
@ -74,7 +75,7 @@ internal class FileUploader @Inject constructor(@Authenticated
|
|||
return Try {
|
||||
okHttpClient.newCall(request).execute().use { response ->
|
||||
if (!response.isSuccessful) {
|
||||
throw IOException()
|
||||
throw response.toFailure()
|
||||
} else {
|
||||
response.body()?.source()?.let {
|
||||
responseAdapter.fromJson(it)
|
||||
|
|
Loading…
Reference in a new issue