Skip to content

Commit 5078d12

Browse files
committed
tidyup based on pr
1 parent 87a75ad commit 5078d12

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

plutus-pab/src/Plutus/PAB/Core/ContractInstance/BlockchainEnv.hs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,17 @@ startNodeClient socket mode slotConfig networkId instancesState = do
5858
case mode of
5959
MockNode ->
6060
void $ MockClient.runChainSync socket slotConfig
61-
(\block slot -> STM.atomically $ handleSyncAction $ processMockBlock instancesState env block slot)
61+
(\block slot -> handleSyncAction $ processMockBlock instancesState env block slot)
6262
AlonzoNode -> do
6363
let resumePoints = []
6464
void $ Client.runChainSync socket slotConfig networkId resumePoints
65-
(\block slot -> STM.atomically $ handleSyncAction $ processChainSyncEvent env block slot)
65+
(\block slot -> handleSyncAction $ processChainSyncEvent env block slot)
6666
pure env
6767

68-
-- | Deal with errors. For now, we deal with them by simply failing the entire
69-
-- application.
70-
handleSyncAction :: STM (Either SyncActionFailure ()) -> STM ()
71-
handleSyncAction a = a >>= f
72-
where
73-
f (Left e) = error $ "Sync action error: " <> show e
74-
f _ = pure ()
68+
-- | Deal with sync action failures from running this STM action. For now, we
69+
-- deal with them by simply calling `error`; i.e. the application exits.
70+
handleSyncAction :: STM (Either SyncActionFailure ()) -> IO ()
71+
handleSyncAction action = STM.atomically action >>= either (error . show) pure
7572

7673
updateInstances :: IndexedBlock -> InstanceClientEnv -> STM ()
7774
updateInstances IndexedBlock{ibUtxoSpent, ibUtxoProduced} InstanceClientEnv{ceUtxoSpentRequests, ceUtxoProducedRequests} = do

0 commit comments

Comments
 (0)