Improve error message when input cannot be read.
This commit is contained in:
parent
cc8abea2c4
commit
b37bdc8b3e
1 changed files with 2 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue