Changed the error reporting so that we at least print the meta tag if we can't open the file to find the line

This commit is contained in:
Neil Brown 2008-02-11 01:15:56 +00:00
parent 3b9d75d488
commit 1151fab5ad

View File

@ -61,7 +61,7 @@ dieIO :: (Monad m, MonadIO m) => ErrorReport -> m a
dieIO (Just m@(Meta (Just fn) line column),s) = liftIO $
-- If we can't read the file successfully, still print our original error
-- rather than a "can't read file" error:
do fileContents <- catch (readFile fn) (\_ -> printError s)
do fileContents <- catch (readFile fn) (\_ -> printError (show m ++ s))
let startingLine = max 1 (line - contextLines)
let lines = map replaceTabs $ getLines fileContents (startingLine) ((2 * contextLines) + 1)
putStrLn $ fn ++ ":"