diff --git a/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt b/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt index 9d478f34..d42bce64 100644 --- a/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt +++ b/vector/src/main/java/im/vector/riotx/core/error/ErrorFormatter.kt @@ -31,15 +31,14 @@ class ErrorFormatter @Inject constructor(val stringProvider: StringProvider) { fun toHumanReadable(throwable: Throwable?): String { return when (throwable) { - null -> "" + null -> null is Failure.NetworkConnection -> stringProvider.getString(R.string.error_no_network) is Failure.ServerError -> { throwable.error.message.takeIf { it.isNotEmpty() } - ?: throwable.error.code.takeIf { it.isNotEmpty() } - ?: stringProvider.getString(R.string.unknown_error) + ?: throwable.error.code.takeIf { it.isNotEmpty() } } else -> throwable.localizedMessage - ?: stringProvider.getString(R.string.unknown_error) } + ?: stringProvider.getString(R.string.unknown_error) } } \ No newline at end of file