Skip to content

Commit

Permalink
style(internal): make getOrThrow terse and consistent
Browse files Browse the repository at this point in the history
chore: unknown commit message
  • Loading branch information
stainless-bot authored and Stainless Bot committed Oct 30, 2024
1 parent c4d5fbd commit 44ab47a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions openai-java-core/src/main/kotlin/com/openai/core/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ import com.openai.errors.OpenAIInvalidDataException
import java.util.Collections

@JvmSynthetic
internal fun <T : Any> T?.getOrThrow(name: String): T {
if (this == null) {
throw OpenAIInvalidDataException("'${name}' is not present")
}

return this
}
internal fun <T : Any> T?.getOrThrow(name: String): T =
this ?: throw OpenAIInvalidDataException("`${name}` is not present")

@JvmSynthetic
internal fun <T> List<T>.toUnmodifiable(): List<T> {
Expand Down

0 comments on commit 44ab47a

Please sign in to comment.