Skip to content

Commit af1968c

Browse files
authored
Merge pull request #132 from mlabs-haskell/nazrhom/fix-fetch-protocol-params
Fix fetching of protocol paramters if they are not specified in confi…
2 parents a84a95f + ea76c30 commit af1968c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PlutusConfig/Cardano/Api/Shelley.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Config.Schema (
2020
naturalSpec,
2121
sectionsSpec,
2222
)
23+
import Control.Exception (IOException, catch)
2324
import Data.Aeson qualified as JSON
2425
import Data.ByteString.Lazy qualified as LazyByteString
2526
import Data.Default (def)
@@ -276,7 +277,7 @@ instance HasSpec ProtocolParameters where
276277
pure ProtocolParameters {..}
277278

278279
readProtocolParametersJSON :: FilePath -> IO (Either String ProtocolParameters)
279-
readProtocolParametersJSON fn = JSON.eitherDecode <$> LazyByteString.readFile fn
280+
readProtocolParametersJSON fn = (JSON.eitherDecode <$> LazyByteString.readFile fn) `catch` (\(e :: IOException) -> pure $ Left (show e))
280281

281282
writeProtocolParametersJSON :: FilePath -> ProtocolParameters -> IO ()
282283
writeProtocolParametersJSON fn params =

0 commit comments

Comments
 (0)