@@ -17,6 +17,7 @@ import Ouroboros.Network.Diffusion.Topology (NetworkTopology (..))
1717import Ouroboros.Network.OrphanInstances (localRootPeersGroupsFromJSON ,
1818 networkTopologyFromJSON , networkTopologyToJSON )
1919import Ouroboros.Network.PeerSelection.LedgerPeers.Type (LedgerPeerSnapshot )
20+ import System.Exit (die )
2021
2122data NoExtraConfig = NoExtraConfig
2223 deriving Show
@@ -55,10 +56,8 @@ readTopologyFile nc = do
5556 handler e = Text. pack $ " DMQ.Topology.readTopologyFile: "
5657 ++ displayException e
5758 handlerJSON :: String -> Text
58- handlerJSON err = mconcat
59- [ " Is your topology file formatted correctly? "
60- , " Expecting P2P Topology file format. "
61- , " The port and valency fields should be numerical. "
59+ handlerJSON err = Text. unlines
60+ [ " topology parsing error:"
6261 , Text. pack err
6362 ]
6463
@@ -67,8 +66,7 @@ readTopologyFileOrError
6766 -> IO (NetworkTopology NoExtraConfig NoExtraFlags )
6867readTopologyFileOrError nc =
6968 readTopologyFile nc
70- >>= either (\ err -> error $ " DMQ.Topology.readTopologyFile: "
71- <> Text. unpack err)
69+ >>= either (die . Text. unpack)
7270 pure
7371
7472readPeerSnapshotFile :: FilePath -> IO (Either Text LedgerPeerSnapshot )
@@ -86,14 +84,13 @@ readPeerSnapshotFile psf = do
8684 handler e = Text. pack $ " DMQ.Topology.readLedgerPeerSnapshotFile: "
8785 ++ displayException e
8886 handlerJSON :: String -> Text
89- handlerJSON err = mconcat
90- [ " Is your snapshot file formatted correctly? "
87+ handlerJSON err = Text. unlines
88+ [ " snapshot file parging error: "
9189 , Text. pack err
9290 ]
9391
9492readPeerSnapshotFileOrError :: FilePath -> IO LedgerPeerSnapshot
9593readPeerSnapshotFileOrError psf =
9694 readPeerSnapshotFile psf
97- >>= either (\ err -> error $ " DMQ.Topology.readLedgerPeerSnapshotFile: "
98- <> Text. unpack err)
95+ >>= either (die . Text. unpack)
9996 pure
0 commit comments