More friendly handling of errors writing files from :dumptests

This commit is contained in:
David Thrane Christiansen 2019-03-19 13:34:31 -07:00
parent 508327058b
commit 209686bb60

View File

@ -317,8 +317,10 @@ dumpTestsCmd outFile str =
do argOut <- mapM (rEval . E.ppValue ppopts) args
resOut <- rEval (E.ppValue ppopts x)
return (renderOneLine resOut ++ "\t" ++ intercalate "\t" (map renderOneLine argOut) ++ "\n")
io $ writeFile outFile (concat out)
io $ writeFile outFile (concat out) `X.catch` handler
where
handler :: X.SomeException -> IO ()
handler e = putStrLn (X.displayException e)