diff --git a/src/PlutusConfig/Cardano/Api/Shelley.hs b/src/PlutusConfig/Cardano/Api/Shelley.hs index fbcc53b8..94e8f750 100644 --- a/src/PlutusConfig/Cardano/Api/Shelley.hs +++ b/src/PlutusConfig/Cardano/Api/Shelley.hs @@ -20,6 +20,7 @@ import Config.Schema ( naturalSpec, sectionsSpec, ) +import Control.Exception (IOException, catch) import Data.Aeson qualified as JSON import Data.ByteString.Lazy qualified as LazyByteString import Data.Default (def) @@ -276,7 +277,7 @@ instance HasSpec ProtocolParameters where pure ProtocolParameters {..} readProtocolParametersJSON :: FilePath -> IO (Either String ProtocolParameters) -readProtocolParametersJSON fn = JSON.eitherDecode <$> LazyByteString.readFile fn +readProtocolParametersJSON fn = (JSON.eitherDecode <$> LazyByteString.readFile fn) `catch` (\(e :: IOException) -> pure $ Left (show e)) writeProtocolParametersJSON :: FilePath -> ProtocolParameters -> IO () writeProtocolParametersJSON fn params =