Skip to content

Commit

Permalink
Document some non-nullable Kotlin extensions can throw `NoSuchElement…
Browse files Browse the repository at this point in the history
…Exception`

Closes spring-projectsgh-31189
  • Loading branch information
sdeleuze committed Sep 8, 2023
1 parent 740f3b7 commit 2d79c4c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -110,6 +110,7 @@ suspend fun RSocketRequester.RetrieveSpec.sendAndAwait() {
/**
* Coroutines variant of [RSocketRequester.RetrieveSpec.retrieveMono].
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
* @since 5.2
*/
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,10 +19,12 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactor.awaitSingleOrNull
import org.springframework.dao.EmptyResultDataAccessException
import reactor.core.publisher.Mono

/**
* Non-nullable Coroutines variant of [RowsFetchSpec.one].
*
* @throws EmptyResultDataAccessException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
*/
@Suppress("DEPRECATION")
Expand All @@ -42,6 +44,7 @@ suspend fun <T> RowsFetchSpec<T>.awaitOneOrNull(): T? =
/**
* Non-nullable Coroutines variant of [RowsFetchSpec.first].
*
* @throws EmptyResultDataAccessException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
*/
@Suppress("DEPRECATION")
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -102,6 +102,7 @@ suspend inline fun <reified T : Any> ClientResponse.awaitBody(): T =
* `KClass` non-nullable coroutines variant of [ClientResponse.bodyToMono].
* Please consider `awaitBody<Foo>` variant if possible.
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Igor Manushin
* @since 5.3
*/
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -143,6 +143,7 @@ inline fun <reified T : Any> WebClient.ResponseSpec.bodyToFlow(): Flow<T> =
/**
* Coroutines variant of [WebClient.ResponseSpec.bodyToMono].
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
* @since 5.2
*/
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,6 +76,7 @@ fun <T : Any> ServerRequest.bodyToFlow(clazz: KClass<T>): Flow<T> =
/**
* Non-nullable Coroutines variant of [ServerRequest.bodyToMono].
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Sebastien Deleuze
* @since 5.2
*/
Expand All @@ -86,6 +87,7 @@ suspend inline fun <reified T : Any> ServerRequest.awaitBody(): T =
* `KClass` non-nullable Coroutines variant of [ServerRequest.bodyToMono].
* Please consider `awaitBody<Foo>` variant if possible.
*
* @throws NoSuchElementException if the underlying [Mono] does not emit any value
* @author Igor Manushin
* @since 5.3
*/
Expand Down

0 comments on commit 2d79c4c

Please sign in to comment.