diff --git a/build.gradle b/build.gradle index 13b721a..95bc8b6 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,6 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.jetbrains.kotlin:kotlin-reflect' implementation 'org.jetbrains.kotlin:kotlin-stdlib' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7' implementation 'org.jsoup:jsoup:1.13.1' diff --git a/src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt b/src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt index c6e90c8..af94cbe 100644 --- a/src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt +++ b/src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt @@ -190,12 +190,16 @@ class CacheController { * @param timetable a timetable of the type [TimetableCourseWeek] */ private fun saveTimetableToCache(timetable: TimetableCourseWeek) { - println(timetable.timetable.toString()) - val file = File(StartupController.dirTcorCache, "timetable-${timetable.meta.courseName}-${timetable.meta.weekIndex}.json") val writer = BufferedWriter(FileWriter(file)) - writer.write(Gson().toJson(timetable)) - writer.close() + + try { + writer.write(Gson().toJson(timetable)) + } catch (e: Exception) { + logger.error("something went wrong while trying to write a cache file", e) + } finally { + writer.close() + } } /**