Skip to content

Conversation

@nazrhom
Copy link
Collaborator

@nazrhom nazrhom commented Jul 20, 2022

…g and if file is not present

Previously we would only fetch the file if JSON.decode returned a Left, however if the file is not present an IOError
will be thrown and the code to fetch the file through the CLI was never being executed

Change-type: patch
Signed-off-by: Giovanni Garufi giovanni@mlabs.city

@nazrhom nazrhom requested a review from szg251 July 20, 2022 17:25
Left err -> return $ Left $ "PABConfig: " <> fn <> ": " <> err
Right conf@PABConfig {pcProtocolParamsFile, pcNetwork, pcCliLocation} -> do
pparamsE <- readProtocolParametersJSON (toString pcProtocolParamsFile)
pparamsE <- readProtocolParametersJSON (toString pcProtocolParamsFile) `catch` (\(e :: IOException) -> pure $ Left (show e))
Copy link
Collaborator

@szg251 szg251 Jul 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we include the catch in readProtocolParametersJSON? It already returns an Either, so it would make sense, if IO errors would also be caught there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…g and if file is not present

Previously we would only fetch the file if JSON.decode returned a Left, however if the file is not present an IOError
will be thrown and the code to fetch the file through the CLI was never being executed

Change-type: patch
Signed-off-by: Giovanni Garufi <giovanni@mlabs.city>
@nazrhom nazrhom force-pushed the nazrhom/fix-fetch-protocol-params branch from 552b7bf to 546e3bc Compare July 21, 2022 08:30
@nazrhom nazrhom merged commit af1968c into master Jul 21, 2022
@szg251 szg251 deleted the nazrhom/fix-fetch-protocol-params branch July 21, 2022 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants