Improve error message (#2505)

Fore the case where a target has been created or configured twice with different presets,
avoid showing "null" inside the error message if existing target has not preset,
and append a point.
This commit is contained in:
Louis CAD
2019-08-04 22:34:28 +03:00
committed by Sergey Igushkin
parent b2753a22a2
commit e5e5e9084e
@@ -78,9 +78,9 @@ internal fun <T : KotlinTarget> KotlinTargetsContainerWithPresets.configureOrCre
throw InvalidUserCodeException(
"The target '$targetName' already exists, but it was not created with the '${targetPreset.name}' preset. " +
"To configure it, access it by name in `kotlin.targets`" +
" or use the preset function '${existingTarget.preset?.name}'"
.takeIf { existingTarget.preset != null }
" or use the preset function '${existingTarget.preset?.name}'."
.takeIf { existingTarget.preset != null } ?: "."
)
}
}
}
}