From b2721c6b02c860553b5ec7c2596652adac2f2f0f Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Thu, 24 Nov 2016 11:39:09 -0500 Subject: 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. --- src/Text/Pandoc/Class.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/Text/Pandoc/Class.hs') diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs index f7915b27d..0135ac6b3 100644 --- a/src/Text/Pandoc/Class.hs +++ b/src/Text/Pandoc/Class.hs @@ -105,7 +105,7 @@ getPOSIXTime = utcTimeToPOSIXSeconds <$> getCurrentTime -- We can add to this as we go data PandocExecutionError = PandocFileReadError String - deriving Show + deriving (Show, Typeable) -- Nothing in this for now, but let's put it there anyway. data PandocStateIO = PandocStateIO @@ -174,10 +174,7 @@ data TestEnv = TestEnv { envEnv :: [(String, String)] , envFontFiles :: [FilePath] } -data TestException = TestException - deriving (Show, Typeable) - -instance E.Exception TestException +instance E.Exception PandocExecutionError newtype PandocPure a = PandocPure { unPandocPure :: ExceptT PandocExecutionError @@ -230,7 +227,7 @@ instance PandocMonad PandocPure where fps <- asks envFiles case lookup fp fps of Just bs -> return (Right (bs, getMimeType fp)) - Nothing -> return (Left $ E.toException TestException) + Nothing -> return (Left $ E.toException $ PandocFileReadError "oops") fetchItem' media sourceUrl nm = do case lookupMedia nm media of -- cgit v1.2.3