From 4f909c626c4fe211d38a93c4db9ed70ab60dbb72 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 12 Sep 2019 08:40:32 -0700
Subject: [PATCH] Change exit codes.

It's good practice not to use codes 1-2 for user errors.
Also, we used 65 for two different errors.

- PandocAppError was 1, is now 4
- PandocOptionError was 2, is now 6
- PandocMakePDFError was 65, is now 66
---
 MANUAL.txt               | 6 +++---
 src/Text/Pandoc/Error.hs | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MANUAL.txt b/MANUAL.txt
index 93ecbc1b9..0f0a9008d 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -1382,10 +1382,10 @@ Exit codes
 If pandoc completes successfully, it will return exit code 0.
 Nonzero exit codes have the following meanings:
 
-     1 PandocAppError
-     2 PandocOptionError
      3 PandocFailOnWarningError
+     4 PandocAppError
      5 PandocTemplateError
+     6 PandocOptionError
     31 PandocEpubSubdirectoryError
     43 PandocPDFError
     47 PandocPDFProgramNotFoundError
@@ -1394,7 +1394,7 @@ Nonzero exit codes have the following meanings:
     63 PandocSomeError
     64 PandocParseError
     65 PandocParsecError
-    65 PandocMakePDFError TODO DUP
+    66 PandocMakePDFError
     67 PandocSyntaxMapError
     83 PandocFilterError
     91 PandocMacroLoop
diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs
index afb18a2f6..2d87fed33 100644
--- a/src/Text/Pandoc/Error.hs
+++ b/src/Text/Pandoc/Error.hs
@@ -85,8 +85,8 @@ handleError (Left e) =
                      if sourceName errPos == "source"
                         then errorInFile
                         else ""
-    PandocMakePDFError s -> err 65 s
-    PandocOptionError s -> err 2 s
+    PandocMakePDFError s -> err 66 s
+    PandocOptionError s -> err 6 s
     PandocSyntaxMapError s -> err 67 s
     PandocFailOnWarningError -> err 3 "Failing because there were warnings."
     PandocPDFProgramNotFoundError pdfprog -> err 47 $
@@ -99,7 +99,7 @@ handleError (Left e) =
     PandocResourceNotFound fn -> err 99 $
         "File " ++ fn ++ " not found in resource path"
     PandocTemplateError s -> err 5 $ "Error compiling template " ++ s
-    PandocAppError s -> err 1 s
+    PandocAppError s -> err 4 s
     PandocEpubSubdirectoryError s -> err 31 $
       "EPUB subdirectory name '" ++ s ++ "' contains illegal characters"
     PandocMacroLoop s -> err 91 $