Error: Added PandocOptionError.

This commit is contained in:
John MacFarlane
2017-04-04 14:35:00 +02:00
parent f1eb3b3169
commit e650d1fbfd
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ parseOptions options' defaults = do
let unknownOptionErrors = foldr handleUnrecognizedOption [] unrecognizedOpts
unless (null errors && null unknownOptionErrors) $
E.throwIO $ PandocAppError 2 $
E.throwIO $ PandocOptionError $
concat errors ++ unlines unknownOptionErrors ++
("Try " ++ prg ++ " --help for more information.")
+2
View File
@@ -51,6 +51,7 @@ data PandocError = PandocIOError String IOError
| PandocParseError String
| PandocParsecError Input ParseError
| PandocMakePDFError String
| PandocOptionError String
| PandocAppError Int String
deriving (Show, Typeable, Generic)
@@ -77,6 +78,7 @@ handleError (Left e) =
else ""
in err 65 $ "\nError at " ++ show err' ++ errorInFile
PandocMakePDFError s -> err 65 s
PandocOptionError s -> err 2 s
PandocAppError ec s -> err ec s
err :: Int -> String -> IO a