Catch exceptions
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
module Data.Email where
|
||||
|
||||
import Data.Email.Header
|
||||
@ -9,5 +10,7 @@ import qualified Data.Conduit.Text as CT
|
||||
import Data.ByteString
|
||||
(ByteString)
|
||||
|
||||
parseEmail :: (MonadThrow m, Monad m) => ConduitM ByteString Header m ()
|
||||
parseEmail = CT.decode CT.utf8 .| CT.lines .| C.concatMap decode
|
||||
parseEmail :: (MonadUnliftIO m, MonadThrow m, Monad m) => ConduitM ByteString Header m ()
|
||||
parseEmail = catchC (CT.decode CT.utf8) err .| CT.lines .| C.concatMap decode
|
||||
where
|
||||
err e = liftIO (print @CT.TextException e) >> yield ""
|
||||
|
Reference in New Issue
Block a user