@@ -10,12 +10,13 @@ import Universum
10
10
11
11
import Control.Concurrent.STM (putTMVar , swapTMVar , tryReadTBQueue , tryReadTMVar ,
12
12
tryTakeTMVar , readTBQueue , TBQueue )
13
- import Control.Exception.Safe (handleAny )
13
+ import Control.Exception (IOException )
14
+ import Control.Exception.Safe (catch , handleAny )
14
15
import Control.Lens (to )
15
16
import Control.Monad.STM (retry )
16
17
import qualified Data.List.NonEmpty as NE
17
18
import Data.Time.Units (Second )
18
- import Formatting (build , int , sformat , (%) )
19
+ import Formatting (build , int , sformat , shown , (%) )
19
20
import Mockable (delay )
20
21
import qualified System.Metrics.Gauge as Gauge
21
22
import System.Wlog (logDebug , logError , logInfo , logWarning )
@@ -26,7 +27,8 @@ import Pos.Block.Network.Logic (BlockNetLogicException (..), handleBlo
26
27
triggerRecovery )
27
28
import Pos.Block.RetrievalQueue (BlockRetrievalQueueTag , BlockRetrievalTask (.. ))
28
29
import Pos.Block.Types (RecoveryHeaderTag )
29
- import Pos.Core (Block , HasHeaderHash (.. ), HeaderHash , difficultyL , isMoreDifficult )
30
+ import Pos.Core (Block , HasHeaderHash (.. ), HeaderHash , difficultyL , headerHashF ,
31
+ isMoreDifficult )
30
32
import Pos.Core.Block (BlockHeader )
31
33
import Pos.Core.Chrono (NE , OldestFirst (.. ), _OldestFirst )
32
34
import Pos.Crypto (ProtocolMagic , shortHashF )
@@ -147,10 +149,15 @@ retrievalWorker pm diffusion = do
147
149
-- again.
148
150
handleRecoveryE nodeId rHeader e = do
149
151
-- REPORT:ERROR 'reportOrLogW' in block retrieval worker/recovery.
150
- reportOrLogW (sformat
151
- (" handleRecoveryE: error handling nodeId=" % build% " , header=" % build% " : " )
152
- nodeId (headerHash rHeader)) e
152
+ reportOrLogW (sformat errfmt nodeId (headerHash rHeader)) e
153
+ `catch` handleIOException
153
154
dropRecoveryHeaderAndRepeat pm diffusion nodeId
155
+ where
156
+ errfmt = " handleRecoveryE: error handling nodeId=" % build% " , header=" % headerHashF% " : "
157
+
158
+ handleIOException :: IOException -> m ()
159
+ handleIOException _ = logError $ sformat (errfmt% shown) nodeId (headerHash rHeader) e
160
+
154
161
155
162
-- Recovery handling. We assume that header in the recovery variable is
156
163
-- appropriate and just query headers/blocks.
0 commit comments