From e650d1fbfd2e2486dac939638bde5c0d325da8a9 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 4 Apr 2017 14:34:39 +0200 Subject: Error: Added PandocOptionError. --- src/Text/Pandoc/App.hs | 2 +- src/Text/Pandoc/Error.hs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index 886055849..107ca435f 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -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.") diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs index 252c469b1..454ad9982 100644 --- a/src/Text/Pandoc/Error.hs +++ b/src/Text/Pandoc/Error.hs @@ -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 -- cgit v1.2.3