git.iko.soy/typeable/cabal2nix
on master help sign in
Better error reporting in case of IO errors
0a35af1Benno Fünfstück
src/Cabal2Nix/Package.hs+1−1
@@ -131,7 +131,7 @@ cabalFromFile failHard file =
131 -- that do not represent valid characters. To catch that exception, we need to
131 -- that do not represent valid characters. To catch that exception, we need to
132 -- wrap the whole block in `catchIO`, because of lazy IO. The `case` will force
132 -- wrap the whole block in `catchIO`, because of lazy IO. The `case` will force
133 -- the reading of the file, so we will always catch the expression here.
133 -- the reading of the file, so we will always catch the expression here.
134− MaybeT $ handleIO (const $ return Nothing) $ do
134+ MaybeT $ handleIO (\err -> Nothing <$ hPutStrLn stderr ("*** parsing cabal file: " ++ show err)) $ do
135 content <- readFile file
135 content <- readFile file
136 case Cabal.parsePackageDescription content of
136 case Cabal.parsePackageDescription content of
137 Cabal.ParseFailed e | failHard -> do
137 Cabal.ParseFailed e | failHard -> do