git.iko.soy/typeable/pandoc
on master help sign in
Make PandocExecutionError an exception

Until we fix fetchItem and fetchItem' to make use of MonadError, we have to thow an exception. We'll throw PandocFileReadError. Note that this is temporary.

commitb2721c6b02c860553b5ec7c2596652adac2f2f0f authorJesse Rosenthal <jrosenthal@jhu.edu> dateThu 24 Nov 2016, 11:39 (10 years ago) parent211d0f9
1 file changed+3−6
src/Text/Pandoc/Class.hs+3−6
src/Text/Pandoc/Class.hs+3−6
@@ -105,7 +105,7 @@ getPOSIXTime = utcTimeToPOSIXSeconds <$> getCurrentTime
105105
106106-- We can add to this as we go
107107data PandocExecutionError = PandocFileReadError String
108− deriving Show
108+ deriving (Show, Typeable)
109109
110110-- Nothing in this for now, but let's put it there anyway.
111111data PandocStateIO = PandocStateIO
@@ -174,10 +174,7 @@ data TestEnv = TestEnv { envEnv :: [(String, String)]
174174 , envFontFiles :: [FilePath]
175175 }
176176
177−data TestException = TestException
178− deriving (Show, Typeable)
179−
180−instance E.Exception TestException
177+instance E.Exception PandocExecutionError
181178
182179newtype PandocPure a = PandocPure {
183180 unPandocPure :: ExceptT PandocExecutionError
@@ -230,7 +227,7 @@ instance PandocMonad PandocPure where
230227 fps <- asks envFiles
231228 case lookup fp fps of
232229 Just bs -> return (Right (bs, getMimeType fp))
233− Nothing -> return (Left $ E.toException TestException)
230+ Nothing -> return (Left $ E.toException $ PandocFileReadError "oops")
234231
235232 fetchItem' media sourceUrl nm = do
236233 case lookupMedia nm media of