Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Throwable does not need to be nullable
If there is no cause we use the existing exception so this will never be
null.
  • Loading branch information
code-asher committed May 1, 2023
commit 88c329719de8b0e2df541da89df5928081d53587
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class CoderGatewayConnectionProvider : GatewayConnectionProvider {
},
update = { _, e, remaining, ->
if (remaining != null) {
indicator.text2 = e?.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
indicator.text2 = e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
indicator.text = CoderGatewayBundle.message("gateway.connector.coder.connection.retry-error.text", remaining)
} else {
ApplicationManager.getApplication().invokeAndWait {
Messages.showMessageDialog(
e?.message ?: CoderGatewayBundle.message("gateway.connector.no-details"),
e.message ?: CoderGatewayBundle.message("gateway.connector.no-details"),
CoderGatewayBundle.message("gateway.connector.coder.connection.error.text"),
Messages.getErrorIcon())
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/com/coder/gateway/sdk/Retry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
import kotlin.coroutines.cancellation.CancellationException
import kotlin.math.min

fun unwrap(ex: Exception): Throwable? {
fun unwrap(ex: Exception): Throwable {
var cause = ex.cause
while(cause?.cause != null) {
cause = cause.cause
Expand All @@ -37,8 +37,8 @@ suspend fun <T> suspendingRetryWithExponentialBackOff(
backOffJitter: Double = 0.1,
label: String,
logger: Logger,
predicate: (e: Throwable?) -> Boolean,
update: (attempt: Int, e: Throwable?, remaining: String?) -> Unit,
predicate: (e: Throwable) -> Boolean,
update: (attempt: Int, e: Throwable, remaining: String?) -> Unit,
action: suspend (attempt: Int) -> T?
): T? {
val random = Random()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
},
update = { _, e, remaining ->
cbIDEComment.foreground = UIUtil.getErrorForeground()
cbIDEComment.text = e?.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
cbIDEComment.text = e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
cbIDE.renderer =
if (remaining != null) IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.remoteproject.retry-error.text", remaining))
else IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.remoteproject.error.text"), UIUtil.getBalloonErrorIcon())
Expand Down