update error handle

This commit is contained in:
2026-02-16 17:40:21 +03:00
parent b47bba9e22
commit d64f2b5b8f
7 changed files with 61 additions and 13 deletions

View File

@@ -16,7 +16,8 @@ private const val LOG_TAG = "NETWORK_DEBUG"
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
@Inject lateinit var getScheduleUseCase: GetScheduleUseCase
@Inject
lateinit var getScheduleUseCase: GetScheduleUseCase
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -29,8 +30,9 @@ class MainActivity : ComponentActivity() {
val src = if (result.refreshedFromNetwork) "NETWORK" else "CACHE"
Log.d(LOG_TAG, "FROM $src: ${result.data}")
}
is DataResult.Error -> {
Log.e(LOG_TAG, "ERROR", result.throwable)
Log.e(LOG_TAG, "ERROR: $result")
}
}
}

View File

@@ -12,13 +12,13 @@ import javax.inject.Singleton
@InstallIn(SingletonComponent::class)
object AppConfigModule {
private const val BASE_PROD_URL = "https://tulsu.ru/schedule/queries/"
private const val BASE_DEVELOP_URL = "https://tulsu.ru/schedule/queries/"
private const val BASE_URL_PROD = "https://tulsu.ru/schedule/queries/"
private const val BASE_URL_DEVELOP = "https://scherbatykh.ru/app/tsudesk/"
@Provides
@Singleton
fun provideAppConfig(): AppConfig {
val baseUrl = if (BuildConfig.DEBUG) BASE_DEVELOP_URL else BASE_PROD_URL
val baseUrl = if (BuildConfig.DEBUG) BASE_URL_DEVELOP else BASE_URL_PROD
return AppConfig(
isDebug = BuildConfig.DEBUG,
baseUrl = baseUrl,