git.iko.soy/typeable/pandoc
on master help sign in
Define Typeable and Exception instances for PandocError.
04307a1John MacFarlane
src/Text/Pandoc/Error.hs+6−1
@@ -1,3 +1,4 @@
1+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
1{-
2{-
2Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
3Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu>
3
4
@@ -33,6 +34,9 @@ module Text.Pandoc.Error (PandocError(..), handleError) where
33import Text.Parsec.Error
34import Text.Parsec.Error
34import Text.Parsec.Pos hiding (Line)
35import Text.Parsec.Pos hiding (Line)
35import Text.Pandoc.Compat.Except
36import Text.Pandoc.Compat.Except
37+import GHC.Generics (Generic)
38+import Data.Generics (Data, Typeable)
39+import Control.Exception (Exception)
36
40
37type Input = String
41type Input = String
38
42
@@ -40,8 +44,9 @@ data PandocError = -- | Generic parse failure
40 ParseFailure String
44 ParseFailure String
41 -- | Error thrown by a Parsec parser
45 -- | Error thrown by a Parsec parser
42 | ParsecError Input ParseError
46 | ParsecError Input ParseError
43− deriving (Show)
47+ deriving (Show, Typeable, Generic)
44
48
49+instance Exception PandocError
45
50
46instance Error PandocError where
51instance Error PandocError where
47 strMsg = ParseFailure
52 strMsg = ParseFailure