Skip to content

Commit bb83a77

Browse files
authored
Merge pull request #94 from viartemev/fix-catch
ResumeWithException on exception
2 parents 0c392c8 + 79d07b6 commit bb83a77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/kotlin/com/viartemev/thewhiterabbit/publisher/ConfirmPublisher.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import kotlinx.coroutines.async
77
import kotlinx.coroutines.coroutineScope
88
import kotlinx.coroutines.suspendCancellableCoroutine
99
import mu.KotlinLogging
10-
import java.io.IOException
1110
import java.util.concurrent.ConcurrentHashMap
1211
import kotlin.coroutines.Continuation
12+
import kotlin.coroutines.resumeWithException
1313

1414
private val logger = KotlinLogging.logger {}
1515

@@ -35,8 +35,8 @@ class ConfirmPublisher internal constructor(private val channel: Channel) {
3535
continuations[messageSequenceNumber] = continuation
3636
message.run { channel.basicPublish(exchange, routingKey, properties, msg.toByteArray()) }
3737
}
38-
} catch (e: IOException) {
39-
continuations.remove(messageSequenceNumber)
38+
} catch (e: Exception) {
39+
continuations[messageSequenceNumber]?.resumeWithException(e)
4040
}
4141
throw PublishException("Can't publish message: $message")
4242
}

0 commit comments

Comments
 (0)