diff --git a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/NetworkError.kt b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/NetworkError.kt index 50953a4..024c234 100644 --- a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/NetworkError.kt +++ b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/NetworkError.kt @@ -1,6 +1,6 @@ package gq.kirmanak.mealient.datasource -sealed class NetworkError(cause: Throwable) : RuntimeException(cause) { +sealed class NetworkError(cause: Throwable) : RuntimeException(cause.message, cause) { class Unauthorized(cause: Throwable) : NetworkError(cause) class NoServerConnection(cause: Throwable) : NetworkError(cause) class NotMealie(cause: Throwable) : NetworkError(cause) diff --git a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/impl/BaseUrlInterceptor.kt b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/impl/BaseUrlInterceptor.kt index b64ae1f..8796804 100644 --- a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/impl/BaseUrlInterceptor.kt +++ b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/impl/BaseUrlInterceptor.kt @@ -38,6 +38,6 @@ class BaseUrlInterceptor @Inject constructor( private fun getBaseUrl() = runBlocking { val url = serverUrlProvider.getUrl() ?: throw IOException("Base URL is unknown") - url.runCatching { toHttpUrl() }.recover { throw IOException(it) }.getOrThrow() + url.runCatching { toHttpUrl() }.recover { throw IOException(it.message, it) }.getOrThrow() } } \ No newline at end of file