From b37bdc8b3ef487d11223899e6619c9311e17af8b Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Tue, 3 Dec 2024 19:01:43 +0100 Subject: [PATCH] Improve error message when input cannot be read. --- 2024/src/main/kotlin/Utils.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2024/src/main/kotlin/Utils.kt b/2024/src/main/kotlin/Utils.kt index 232ead7..b6e6693 100644 --- a/2024/src/main/kotlin/Utils.kt +++ b/2024/src/main/kotlin/Utils.kt @@ -1,8 +1,8 @@ fun readInput(name: String) = bufferedReader(name) ?.lineSequence() - ?: error("Cannot read input") + ?: error("Cannot read input $name") -fun readInputString(name: String): String = bufferedReader(name)?.readText() ?: error("Cannot read input") +fun readInputString(name: String): String = bufferedReader(name)?.readText() ?: error("Cannot read input $name") private fun bufferedReader(name: String) = object {}.javaClass.getResourceAsStream(name) ?.bufferedReader()