Skip to content

Commit d7940c4

Browse files
committed
better comment
1 parent 6ebae76 commit d7940c4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sdk/src/main/kotlin/io/opentdf/platform/sdk/RequestHelper.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import com.connectrpc.getOrThrow
77
class RequestHelper {
88
companion object {
99
/**
10-
* Kotlin doesn't have checked exceptions so that if we want to catch
11-
* an exception thrown by Kotlin we need to declare that the method throws it.
12-
* ResponseMessageKt.getOrThrow() doesn't do so; so we need to wrap it
10+
* Kotlin doesn't have checked exceptions (importantly it doesn't declare them).
11+
* This means that if a Kotlin function throws a checked exception, you can't
12+
* catch it in Java unless it uses the {@class kotlin.jvm.Throws} annotation.
13+
* We wrap the getOrThrow() method in a static method with the annotation we
14+
* need to catch a {@class ConnectException} in Java.
1315
*/
1416
@JvmStatic @Throws(ConnectException::class)
1517
fun <T> getOrThrow(responseMessage: ResponseMessage<T>): T {

0 commit comments

Comments
 (0)