Skip to content

Commit 88c3297

Browse files
committed
Throwable does not need to be nullable
If there is no cause we use the existing exception so this will never be null.
1 parent 4e5206e commit 88c3297

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/kotlin/com/coder/gateway/CoderGatewayConnectionProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ class CoderGatewayConnectionProvider : GatewayConnectionProvider {
4747
},
4848
update = { _, e, remaining, ->
4949
if (remaining != null) {
50-
indicator.text2 = e?.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
50+
indicator.text2 = e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
5151
indicator.text = CoderGatewayBundle.message("gateway.connector.coder.connection.retry-error.text", remaining)
5252
} else {
5353
ApplicationManager.getApplication().invokeAndWait {
5454
Messages.showMessageDialog(
55-
e?.message ?: CoderGatewayBundle.message("gateway.connector.no-details"),
55+
e.message ?: CoderGatewayBundle.message("gateway.connector.no-details"),
5656
CoderGatewayBundle.message("gateway.connector.coder.connection.error.text"),
5757
Messages.getErrorIcon())
5858
}

src/main/kotlin/com/coder/gateway/sdk/Retry.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
1010
import kotlin.coroutines.cancellation.CancellationException
1111
import kotlin.math.min
1212

13-
fun unwrap(ex: Exception): Throwable? {
13+
fun unwrap(ex: Exception): Throwable {
1414
var cause = ex.cause
1515
while(cause?.cause != null) {
1616
cause = cause.cause
@@ -37,8 +37,8 @@ suspend fun <T> suspendingRetryWithExponentialBackOff(
3737
backOffJitter: Double = 0.1,
3838
label: String,
3939
logger: Logger,
40-
predicate: (e: Throwable?) -> Boolean,
41-
update: (attempt: Int, e: Throwable?, remaining: String?) -> Unit,
40+
predicate: (e: Throwable) -> Boolean,
41+
update: (attempt: Int, e: Throwable, remaining: String?) -> Unit,
4242
action: suspend (attempt: Int) -> T?
4343
): T? {
4444
val random = Random()

src/main/kotlin/com/coder/gateway/views/steps/CoderLocateRemoteProjectStepView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
199199
},
200200
update = { _, e, remaining ->
201201
cbIDEComment.foreground = UIUtil.getErrorForeground()
202-
cbIDEComment.text = e?.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
202+
cbIDEComment.text = e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
203203
cbIDE.renderer =
204204
if (remaining != null) IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.remoteproject.retry-error.text", remaining))
205205
else IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.remoteproject.error.text"), UIUtil.getBalloonErrorIcon())

0 commit comments

Comments
 (0)