Report evaluation errors nicely from Main.hs

Fixes #156
This commit is contained in:
John Wiegley 2018-04-10 12:25:34 -07:00
parent a7e7e84795
commit 91b33e250d

View file

@ -15,6 +15,7 @@ import Nix.Expr.Types.Annotated (stripAnnotation)
import Nix.Lint
import Nix.Parser
import Nix.Pretty
import Nix.Stack (NixException(..))
-- import Nix.TH
import Options.Applicative hiding (ParserResult(..))
import System.IO
@ -101,7 +102,10 @@ main = do
then hPutStrLn stderr
else errorWithoutStackTrace) $ "Parse failed: " ++ show err
Success expr -> do
Success expr -> Exc.catch (process expr) $ \case
NixEvalException msg -> errorWithoutStackTrace msg
where
process expr = do
-- expr <- Exc.evaluate $ force expr
-- putStrLn "Parsing file...done"