diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-04-04 14:34:39 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-04-04 14:35:00 +0200 |
commit | e650d1fbfd2e2486dac939638bde5c0d325da8a9 (patch) | |
tree | f85ec277786aa5ba7982d083e50d1e5171960eeb | |
parent | f1eb3b316904a20ccde4b60aa62977ad73e2d6a2 (diff) | |
download | pandoc-e650d1fbfd2e2486dac939638bde5c0d325da8a9.tar.gz |
Error: Added PandocOptionError.
-rw-r--r-- | src/Text/Pandoc/App.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Error.hs | 2 |
2 files changed, 3 insertions, 1 deletions
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 |