@@ -4,6 +4,8 @@ module Network.Wai.Handler.Warp.Settings where
44
55import Control.Exception
66import qualified Data.ByteString as S
7+import qualified Data.Text as T
8+import qualified Data.Text.IO as TIO
79import qualified Data.ByteString.Lazy.Char8 as L8
810import Data.Conduit
911import Data.Conduit.Network (HostPreference (HostIPv4))
@@ -77,7 +79,7 @@ defaultSettings = Settings
7779defaultExceptionHandler :: Maybe Request -> SomeException -> IO ()
7880defaultExceptionHandler _ e = throwIO e `catches` handlers
7981 where
80− handlers = [Handler ah, Handler ih, Handler oh, Handler sh]
82+ handlers = [Handler ah, Handler ih, Handler oh, Handler th, Handler sh]
8183
8284 ah :: AsyncException -> IO ()
8385 ah ThreadKilled = return ()
@@ -93,8 +95,11 @@ defaultExceptionHandler _ e = throwIO e `catches` handlers
9395 where
9496 et = ioeGetErrorType x
9597
98+ th :: TimeoutThread -> IO ()
99+ th TimeoutThread = return ()
100+
96101 sh :: SomeException -> IO ()
97− sh x = hPrint stderr x
102+ sh = TIO.hPutStrLn stderr . T.pack . show
98103
99104defaultExceptionResponse :: SomeException -> Response
100105defaultExceptionResponse _ = responseLBS H.internalServerError500 [(H.hContentType, "text/plain")] "Something went wrong"