diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-24 11:39:09 -0500 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-01-25 17:07:39 +0100 |
commit | b2721c6b02c860553b5ec7c2596652adac2f2f0f (patch) | |
tree | a22c60d248f9da5b05d0fd490cff9e2e2377f62d | |
parent | 211d0f95749aa4de916361463d5c0e246c8ff720 (diff) | |
download | pandoc-b2721c6b02c860553b5ec7c2596652adac2f2f0f.tar.gz |
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.
-rw-r--r-- | src/Text/Pandoc/Class.hs | 9 |
1 files changed, 3 insertions, 6 deletions
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 |