From e036f934f6b36e7c44deee775142eea28291c2f7 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 14 Apr 2014 08:32:55 +0300 Subject: [PATCH] Add MonadCatch for WidgetT --- yesod-core/Yesod/Core/Types.hs | 7 +++++++ yesod-core/yesod-core.cabal | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/yesod-core/Yesod/Core/Types.hs b/yesod-core/Yesod/Core/Types.hs index eb0f6090..bd76e99e 100644 --- a/yesod-core/Yesod/Core/Types.hs +++ b/yesod-core/Yesod/Core/Types.hs @@ -424,6 +424,13 @@ instance MonadCatch m => MonadCatch (HandlerT site m) where uninterruptibleMask a = HandlerT $ \e -> uninterruptibleMask $ \u -> unHandlerT (a $ q u) e where q u (HandlerT b) = HandlerT (u . b) +instance MonadCatch m => MonadCatch (WidgetT site m) where + catch (WidgetT m) c = WidgetT $ \r -> m r `catch` \e -> unWidgetT (c e) r + mask a = WidgetT $ \e -> mask $ \u -> unWidgetT (a $ q u) e + where q u (WidgetT b) = WidgetT (u . b) + uninterruptibleMask a = + WidgetT $ \e -> uninterruptibleMask $ \u -> unWidgetT (a $ q u) e + where q u (WidgetT b) = WidgetT (u . b) #else monadThrow = lift . monadThrow #endif diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 08cfb142..bad68e7e 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.2.12 +version: 1.2.13 license: MIT license-file: LICENSE author: Michael Snoyman