Simplify nested errors

Replace incomprehensible IndexOutOfBoundsException with intelligible exception

#KT-47753 Fixed
This commit is contained in:
Aleksei.Cherepanov
2021-08-06 12:48:52 +03:00
committed by teamcityserver
parent afd9b4935a
commit a4a1d35021
@@ -54,9 +54,12 @@ open class LookupStorage(
try {
if (countersFile.exists()) {
val lines = countersFile.readLines()
size = lines[0].toInt()
size = lines.firstOrNull()?.toIntOrNull() ?: throw IOException("$countersFile exists, but it is empty. " +
"Counters file is corrupted")
oldSize = size
}
} catch (e: IOException) {
throw e
} catch (e: Exception) {
throw IOException("Could not read $countersFile", e)
}