changed conditional style to easier to read/maintain when (like switch) statement

This commit is contained in:
2026-07-05 21:18:49 -05:00
parent 81a3b7ea34
commit e36afc8ade
@@ -211,10 +211,12 @@ internal class ImapConnectionCache(
// FolderClosedException/StoreClosedException are themselves MessagingException subtypes, so these
// definite-drop checks must run before the MessagingException guard below — otherwise they'd fall
// into it and get gated on a `.cause` they don't carry, instead of the unconditional `true` below.
if (error is FolderClosedException || error is StoreClosedException) return true
if (error is IOException || error is ConnectionException) return true
if (error !is MessagingException) return false
return error.cause is IOException || error.cause is ConnectionException
when {
error is FolderClosedException || error is StoreClosedException -> return true
error is IOException || error is ConnectionException -> return true
error !is MessagingException -> return false
else -> return error.cause is IOException || error.cause is ConnectionException
}
}
private companion object {