Skip to content

Commit

Permalink
Merge pull request #246 from anilibria/fix/GHP-60248209-http-error
Browse files Browse the repository at this point in the history
[GHP-60248209] fix: empy http error message
  • Loading branch information
RadiationX authored Jan 7, 2025
2 parents c0a6caa + a79a5aa commit 444ccda
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ru.radiationx.anilibria.ui.common

import com.squareup.moshi.JsonDataException
import com.squareup.moshi.JsonEncodingException
import ru.radiationx.anilibria.presentation.common.IErrorHandler
import ru.radiationx.anilibria.utils.messages.SystemMessenger
import ru.radiationx.data.datasource.remote.ApiError
Expand Down Expand Up @@ -29,7 +28,7 @@ class ErrorHandler @Inject constructor(

private fun getMessage(throwable: Throwable) = when (throwable) {
is IOException -> "Нет соединения с интернетом"
is HttpException -> throwable.message
is HttpException -> "${throwable.code}: ${throwable.message.ifEmpty { "Empty message" }}"
is ApiError -> throwable.userMessage()
is JsonDataException -> "Неправильный формат данных"
else -> throwable.message ?: "Неизвестная ошибка"
Expand Down

0 comments on commit 444ccda

Please sign in to comment.