Use defaultShouldDisplayException

This commit is contained in:
Michael Snoyman 2014-03-25 05:29:45 +02:00
parent 7991edee32
commit edc6bdd581
2 changed files with 10 additions and 2 deletions

View File

@ -14,6 +14,7 @@ import Yesod.Default.Config
import Network.Wai (Application)
import Network.Wai.Handler.Warp
(runSettings, defaultSettings, settingsPort, settingsHost, settingsOnException)
import qualified Network.Wai.Handler.Warp as Warp
import System.Directory (doesDirectoryExist, removeDirectoryRecursive)
import Network.Wai.Middleware.Gzip (gzip, GzipFiles (GzipCacheFolder), gzipFiles, def)
import Network.Wai.Middleware.Autohead (autohead)
@ -68,12 +69,19 @@ defaultMainLog load getApp = do
runSettings defaultSettings
{ settingsPort = appPort config
, settingsHost = appHost config
, settingsOnException = const $ \e -> logFunc
, settingsOnException = const $ \e -> when (shouldLog' e) $ logFunc
$(qLocation >>= liftLoc)
"yesod"
LevelError
(toLogStr $ "Exception from Warp: " ++ show e)
} app
where
shouldLog' =
#if MIN_VERSION_wai(2,1,3)
Warp.defaultShouldDisplayException
#else
const True
#endif
-- | Run your application continously, listening for SIGINT and exiting
-- when received

View File

@ -1,5 +1,5 @@
name: yesod
version: 1.2.5
version: 1.2.5.1
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>