From ea1236f2cf6d3ef4b739b2ca28f47a3bbed42295 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 17 Oct 2023 14:14:48 +0200 Subject: refactor history --- app/Exception.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app/Exception.hs (limited to 'app/Exception.hs') diff --git a/app/Exception.hs b/app/Exception.hs new file mode 100644 index 0000000..83d624d --- /dev/null +++ b/app/Exception.hs @@ -0,0 +1,38 @@ +module Exception + ( AnyException (..), + InvalidTreeGrepperResult (..), + ProcessException (..), + UnknownFileExtension (..), + ) +where + +import Control.Exception +import Data.ByteString.Lazy.Char8 as LB +import System.Exit (ExitCode) + +data AnyException + = InvalidTreeGrepperResult' InvalidTreeGrepperResult + | ProcessException' ProcessException + | UnknownFileExtension' UnknownFileExtension + deriving (Show) + +instance Exception AnyException + +data InvalidTreeGrepperResult = InvalidTreeGrepperResult + { error :: String + } + deriving (Show) + +instance Exception InvalidTreeGrepperResult + +data ProcessException = ProcessException String ExitCode LB.ByteString + deriving (Show) + +instance Exception ProcessException + +data UnknownFileExtension = UnknownFileExtension + { extension :: String + } + deriving (Show) + +instance Exception UnknownFileExtension -- cgit v1.2.3