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:
committed by
Sergey Igushkin
parent
b2753a22a2
commit
e5e5e9084e
+3
-3
@@ -78,9 +78,9 @@ internal fun <T : KotlinTarget> KotlinTargetsContainerWithPresets.configureOrCre
|
|||||||
throw InvalidUserCodeException(
|
throw InvalidUserCodeException(
|
||||||
"The target '$targetName' already exists, but it was not created with the '${targetPreset.name}' preset. " +
|
"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`" +
|
"To configure it, access it by name in `kotlin.targets`" +
|
||||||
" or use the preset function '${existingTarget.preset?.name}'"
|
" or use the preset function '${existingTarget.preset?.name}'."
|
||||||
.takeIf { existingTarget.preset != null }
|
.takeIf { existingTarget.preset != null } ?: "."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user