From f3039601bf135c27b5b74016a3bdd4252a53bb5e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 25 Sep 2019 11:27:23 +0200 Subject: [PATCH] throw Failure instead of meaning less IOException --- .../matrix/android/internal/session/content/FileUploader.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/FileUploader.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/FileUploader.kt index 2ec17248d1..15d75ceeb6 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/FileUploader.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/FileUploader.kt @@ -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)