aboutsummaryrefslogtreecommitdiffstats
path: root/app/Exception.hs
blob: 49c9cb6e66cd0320acdf7c0b3e81be8cdb6493f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module Exception
  ( AnyException (..),
    InvalidTreeGrepperResult (..),
    NoCommits (..),
    ProcessException (..),
    UnknownFileExtension (..),
    InvalidDiff (..),
  )
where

import Control.Exception
import Data.ByteString.Lazy.Char8 as LB
import System.Exit (ExitCode)

data AnyException
  = InvalidTreeGrepperResult' InvalidTreeGrepperResult
  | NoCommits' NoCommits
  | ProcessException' ProcessException
  | UnknownFileExtension' UnknownFileExtension
  | InvalidDiff' InvalidDiff
  deriving (Show)

instance Exception AnyException

data InvalidTreeGrepperResult = InvalidTreeGrepperResult
  { error :: String
  }
  deriving (Show)

instance Exception InvalidTreeGrepperResult

data NoCommits = NoCommits
  deriving (Show)

instance Exception NoCommits

data ProcessException = ProcessException String ExitCode LB.ByteString
  deriving (Show)

instance Exception ProcessException

data UnknownFileExtension = UnknownFileExtension
  { extension :: String
  }
  deriving (Show)

instance Exception UnknownFileExtension

data InvalidDiff = InvalidDiff String
  deriving (Show)

instance Exception InvalidDiff