diff --git a/stack.yaml b/stack.yaml index 8078ababc..207b44900 100644 --- a/stack.yaml +++ b/stack.yaml @@ -14,3 +14,6 @@ packages: - ./yesod - ./yesod-eventsource - ./yesod-websockets + +extra-deps: +- annotated-exception-0.1.2.1 diff --git a/stack.yaml.lock b/stack.yaml.lock index 7940767f2..0e58e9f40 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -3,7 +3,14 @@ # For more information, please see the documentation at: # https://docs.haskellstack.org/en/stable/lock_files -packages: [] +packages: +- completed: + hackage: annotated-exception-0.1.2.1@sha256:6bbc199b76c99aea3fa3c1a8c1272bd507f77704e04d42b39fa4b9d21bb702db,1738 + pantry-tree: + size: 686 + sha256: 1090170c2daa6fafe8a62513ec79583e20eda0df70edd0046488bc6c22aa066d + original: + hackage: annotated-exception-0.1.2.1 snapshots: - completed: size: 585603 diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index 948902042..15ee00c82 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog for yesod-core +## 1.6.22.2 + +* Catches `AnnotatedException HandlerContents` so you can use `annotated-exception` with impunity in your web application code. [#1762](https://github.com/yesodweb/yesod/pull/1762) + ## 1.6.22.1 + Remove sometimes failing superfluous test. [#1756](https://github.com/yesodweb/yesod/pull/1756) diff --git a/yesod-core/src/Yesod/Core/Internal/Run.hs b/yesod-core/src/Yesod/Core/Internal/Run.hs index c1ffe1003..d80c18732 100644 --- a/yesod-core/src/Yesod/Core/Internal/Run.hs +++ b/yesod-core/src/Yesod/Core/Internal/Run.hs @@ -25,6 +25,7 @@ import qualified Control.Exception as EUnsafe import Yesod.Core.Internal.Response import Data.ByteString.Builder (toLazyByteString) import qualified Data.ByteString.Lazy as BL +import Control.Exception.Annotated (AnnotatedException (..)) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Logger (LogLevel (LevelError), LogSource, liftLoc) @@ -116,7 +117,7 @@ basicRunHandler rhe handler yreq resState = do return (HCContent defaultStatus tc)) (\e -> case fromException e of - Just e' -> return e' + Just (AnnotatedException _ e') -> return e' Nothing -> HCError <$> toErrorHandler e) -- Get the raw state and return diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index d900011cf..8b13112e1 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.6.22.1 +version: 1.6.22.2 license: MIT license-file: LICENSE author: Michael Snoyman @@ -27,6 +27,7 @@ library build-depends: base >= 4.10 && < 5 , aeson >= 1.0 + , annotated-exception >= 0.1.0.0 , auto-update , blaze-html >= 0.5 , blaze-markup >= 0.7.1