INNER CODE UNIT · Kotlin
ModuleInfoException
MovingBlocks/Terasology · build-logic/src/main/kotlin/org/terasology/gradology/ModuleInfoException.kt:9
class ModuleInfoException(
cause: Throwable,
@Suppress("MemberVisibilityCanBePrivate") val file: File? = null,
private val project: Project? = null
) : RuntimeException(cause) {
override val message: String
get() {
// trying to get the fully-qualified-class-name-mess off the front and just show
// the useful part.
val detail = cause?.cause?.localizedMessage ?: cause?.localizedMessage
return "Error while reading module info from ${describeFile()}:\n ${detail}"
}
private fun describeFile(): String {
return if (project != null && file != null) {
project.rootProject.relativePath(file)
} else if (file != null) {
file.toString()