Skip to content

Commit

Permalink
rather than error, do nothing when genesis generator errors with Noth…
Browse files Browse the repository at this point in the history
…ingToDo
  • Loading branch information
charlescrain committed Jan 8, 2019
1 parent 40d2d4a commit 833b242
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Chanterelle/Genesis.purs
Expand Up @@ -4,7 +4,7 @@ module Chanterelle.Genesis

import Chanterelle.Internal.Genesis (generateGenesis)
import Chanterelle.Internal.Logging (LogLevel(..), log, logGenesisGenerationError)
import Chanterelle.Internal.Types.Genesis (GenesisGenerationError(MalformedProjectErrorG))
import Chanterelle.Internal.Types.Genesis (GenesisGenerationError(MalformedProjectErrorG, NothingToDo))
import Chanterelle.Internal.Utils.Json (jsonStringifyWithSpaces)
import Chanterelle.Project (loadProject)
import Effect.Aff (error, launchAff, throwError)
Expand All @@ -19,7 +19,7 @@ import Node.Encoding (Encoding(UTF8))
import Node.FS.Aff as FS
import Node.Path (FilePath)
import Node.Process as P
import Prelude (Unit, bind, show, void, ($), (<<<), (<>), (>>=))
import Prelude (Unit, bind, show, void, ($), (<<<), (<>), (>>=), pure, unit)

runGenesisGenerator :: FilePath -> FilePath -> Effect Unit
runGenesisGenerator genesisIn genesisOut = do
Expand All @@ -38,6 +38,9 @@ runGenesisGenerator genesisIn genesisOut = do
_ <- log Error $ "Couldn't write genesis block to " <> show genesisOut <> ": " <> show err
throwError $ error "WriteGenesis Error"
Right _ -> log Info $ "Successfully wrote generated genesis block to " <> show genesisOut
Left (NothingToDo str) -> do
_ <- log Info $ "Nothing for genesis generator to do : " <> str
pure unit
Left err -> do
_ <- logGenesisGenerationError err
throwError $ error "GenerateGenesis Error"

0 comments on commit 833b242

Please sign in to comment.