Пустые дни расписания не считать ошибкой сети

This commit is contained in:
Beluga737 committed 2026-12-04 22:37:58 +07:00
1 parent 7d69cf5a74
commit 32683ee8e8
1 file changed
+7 -1
@@ -72,7 +72,13 @@ object ScheduleRepository {
setRequestProperty("Accept", "application/json")
setRequestProperty("User-Agent", "Helponizer/1.0")
}
if (connection.responseCode !in 200..299) return null
val responseCode = connection.responseCode
if (responseCode == HttpURLConnection.HTTP_FORBIDDEN ||
responseCode == HttpURLConnection.HTTP_NOT_FOUND
) {
return ScheduleDay(date, date.dayOfWeek, emptyList())
}
if (responseCode !in 200..299) return null
val body = connection.inputStream.bufferedReader().use { it.readText() }
parseDay(date, body)
} catch (e: Exception) {