Skip to content

Commit 30ca40d

Browse files
committed
pr feedback
1 parent a37a4f2 commit 30ca40d

File tree

1 file changed

+12
-21
lines changed
  • aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile

1 file changed

+12
-21
lines changed

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsProfile.kt

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ public inline fun <reified T : Enum<T>> AwsProfile.getEnumOrNull(key: String, su
212212
it.name.equals(value, ignoreCase = true)
213213
} ?: throw ConfigurationException(
214214
buildString {
215-
append(key)
216-
append(" '")
217-
append(value)
218-
append("' is not supported, should be one of: ")
215+
append("$key '$value' is not supported, should be one of: ")
219216
enumValues<T>().joinTo(this) { it.name.lowercase() }
220217
},
221218
)
@@ -226,23 +223,17 @@ public inline fun <reified T : Enum<T>> AwsProfile.getEnumOrNull(key: String, su
226223
*/
227224
@InternalSdkApi
228225
public inline fun <reified T : Enum<T>> AwsProfile.getEnumSetOrNull(key: String, subKey: String? = null): Set<T>? =
229-
getOrNull(key, subKey)?.let { rawValue ->
230-
rawValue.split(",")
231-
.map { it ->
232-
val value = it.trim()
233-
enumValues<T>().firstOrNull { enumValue ->
234-
enumValue.name.equals(value, ignoreCase = true)
235-
} ?: throw ConfigurationException(
236-
buildString {
237-
append(key)
238-
append(" '")
239-
append(value)
240-
append("' is not supported, should be one of: ")
241-
enumValues<T>().joinTo(this) { it.name.lowercase() }
242-
},
243-
)
244-
}.toSet()
245-
}
226+
getOrNull(key, subKey)?.split(",")?.map { it ->
227+
val value = it.trim()
228+
enumValues<T>().firstOrNull { enumValue ->
229+
enumValue.name.equals(value, ignoreCase = true)
230+
} ?: throw ConfigurationException(
231+
buildString {
232+
append("$key '$value' is not supported, should be one of: ")
233+
enumValues<T>().joinTo(this) { it.name.lowercase() }
234+
},
235+
)
236+
}?.toSet()
246237

247238
internal fun AwsProfile.getUrlOrNull(key: String, subKey: String? = null): Url? =
248239
getOrNull(key, subKey)?.let {

0 commit comments

Comments
 (0)