diff --git a/app/src/main/java/org/hyperledger/ariesproject/WalletMainActivity.kt b/app/src/main/java/org/hyperledger/ariesproject/WalletMainActivity.kt index d39bbdd..965561b 100644 --- a/app/src/main/java/org/hyperledger/ariesproject/WalletMainActivity.kt +++ b/app/src/main/java/org/hyperledger/ariesproject/WalletMainActivity.kt @@ -48,8 +48,12 @@ class WalletMainActivity : AppCompatActivity() { if (invitation.isNotEmpty()) { val app = application as WalletApp lifecycleScope.launch(Dispatchers.Main) { - val (_, connection) = app.agent.oob.receiveInvitationFromUrl(invitation) - showAlert("Connected to ${connection?.theirLabel ?: "unknown agent"}") + try { + val (_, connection) = app.agent.oob.receiveInvitationFromUrl(invitation) + showAlert("Connected to ${connection?.theirLabel ?: "unknown agent"}") + } catch (e: Exception) { + showAlert("Unable to connect, please check your network connection") + } } } true diff --git a/ariesframework/src/main/java/org/hyperledger/ariesframework/routing/MediationRecipient.kt b/ariesframework/src/main/java/org/hyperledger/ariesframework/routing/MediationRecipient.kt index 106706b..8565432 100644 --- a/ariesframework/src/main/java/org/hyperledger/ariesframework/routing/MediationRecipient.kt +++ b/ariesframework/src/main/java/org/hyperledger/ariesframework/routing/MediationRecipient.kt @@ -176,13 +176,21 @@ class MediationRecipient(private val agent: Agent, private val dispatcher: Dispa if (agent.agentConfig.mediatorPickupStrategy == MediatorPickupStrategy.PickUpV1) { val message = OutboundMessage(BatchPickupMessage(10), mediatorConnection) - agent.messageSender.send(message) + try { + agent.messageSender.send(message) + } catch (e: Exception) { + logger.debug("Pickup messages failed with the following error: ${e.message}") + } } else if (agent.agentConfig.mediatorPickupStrategy == MediatorPickupStrategy.Implicit) { // For implicit pickup, responseRequested must be set to false. // Since no response is requested, the mediator can respond with queued messages. // Otherwise, it would respond with a trust ping response. val message = OutboundMessage(TrustPingMessage("pickup", false), mediatorConnection) - agent.messageSender.send(message, "ws") + try { + agent.messageSender.send(message, "ws") + } catch (e: Exception) { + logger.debug("Pickup messages failed with the following error: ${e.message}") + } } else { throw RuntimeException("Unsupported mediator pickup strategy: ${agent.agentConfig.mediatorPickupStrategy}") }