@@ -10,7 +10,7 @@ where
11import Control.Exception
11import Control.Exception
12import Data.Text (Text)
12import Data.Text (Text)
13−import System.Exit (exitFailure)
13+import System.Exit (ExitCode (ExitFailure), exitWith)
14import System.IO
14import System.IO
15import qualified GHC
15import qualified GHC
16import qualified Outputable as GHC
16import qualified Outputable as GHC
@@ -53,7 +53,13 @@ withPrettyOrmoluExceptions m = m `catch` h
53 h :: OrmoluException -> IO a
53 h :: OrmoluException -> IO a
55 hPutStrLn stderr (displayException e)
55 hPutStrLn stderr (displayException e)
56− exitFailure
56+ exitWith . ExitFailure $
58+ -- Error code 1 is for `error` or `notImplemented`
59+ OrmoluCppEnabled -> 2
60+ OrmoluParsingFailed _ _ -> 3
61+ OrmoluOutputParsingFailed _ _ -> 4
62+ OrmoluASTDiffers _ _ -> 5
58----------------------------------------------------------------------------
64----------------------------------------------------------------------------