File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -37,17 +37,15 @@ import Kore.JsonRpc.Types.ContextLog
37
37
main :: IO ()
38
38
main = do
39
39
Options {cmd, input, output} <- execParser parse
40
- (errors, inputJson) <-
41
- partitionEithers
42
- . map JSON. eitherDecode
40
+ inputData <-
41
+ map JSON. eitherDecode
43
42
. BS. lines
44
43
<$> maybe BS. getContents BS. readFile input
45
- unless (null errors) $ do
46
- putStrLn " JSON parse errors in log file:"
47
- mapM_ putStrLn errors
48
- exitWith (ExitFailure 1 )
49
44
let writeOut = maybe BS. putStrLn BS. writeFile output . BS. unlines
50
- writeOut $ process cmd inputJson
45
+ writeOut $ process cmd $ stopOnErrors inputData
46
+ where
47
+ stopOnErrors :: [Either String LogLine ] -> [LogLine ]
48
+ stopOnErrors = map (either (error . (" JSON parse error: " <> )) id )
51
49
52
50
data Options = Options
53
51
{ cmd :: Command
You can’t perform that action at this time.
0 commit comments