diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Error.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs index 792098b35..292396aee 100644 --- a/src/Text/Pandoc/Error.hs +++ b/src/Text/Pandoc/Error.hs @@ -62,8 +62,12 @@ handleError (Left err) = let errPos = errorPos err' errLine = sourceLine errPos errColumn = sourceColumn errPos - theline = (lines input ++ [""]) !! (errLine - 1) - in error $ "\nError at " ++ show err' ++ "\n" ++ - theline ++ "\n" ++ replicate (errColumn - 1) ' ' ++ - "^" + ls = lines input ++ [""] + errorInFile = if length ls > errLine - 1 + then concat ["\n", (ls !! (errLine - 1)) + ,"\n", replicate (errColumn - 1) ' ' + ,"^"] + else "" + in error $ "\nError at " ++ show err' + ++ errorInFile |