Permalink
Browse files

Another fix for the MonadCatchIO instance re: divergent iteratees

  • Loading branch information...
1 parent 67cc9c6 commit b2f3c4fd9b751c7a7ff6eb338c0e9ce9147461e3 @gregorycollins gregorycollins committed Feb 12, 2011
Showing with 6 additions and 2 deletions.
  1. +1 −1 snap-core.cabal
  2. +5 −1 src/Snap/Iteratee.hs
View
@@ -1,5 +1,5 @@
name: snap-core
-version: 0.4.0.1
+version: 0.4.0.2
synopsis: Snap: A Haskell Web Framework (Core)
description:
View
@@ -137,7 +137,11 @@ instance (Functor m, MonadCatchIO m) =>
catch m handler = Iteratee $ do
ee <- try $ runIteratee (m `catchError` h)
case ee of
- (Left e) -> runIteratee (handler e)
+ -- if we got an async exception here then the iteratee workflow is
+ -- all messed up, we have no reasonable choice but to send EOF to the
+ -- handler, because the unparsed input got lost. If the enumerator
+ -- sends more chunks we can possibly recover later.
+ (Left e) -> runIteratee (enumEOF $$ handler e)
(Right v) -> step v
where
step (Continue k) = return $ Continue (\s -> k s `catch` handler)

0 comments on commit b2f3c4f

Please sign in to comment.