From bef63f59c37f72370da58ac3a8a23d7039600f97 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 21 Dec 2023 12:07:30 -0500 Subject: [PATCH] warp: delete unused ExceptionInsideResponseBody exception --- warp/Network/Wai/Handler/Warp/HTTP1.hs | 10 ++++------ warp/Network/Wai/Handler/Warp/Types.hs | 14 -------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/warp/Network/Wai/Handler/Warp/HTTP1.hs b/warp/Network/Wai/Handler/Warp/HTTP1.hs index c6b43cac7..efcefd502 100644 --- a/warp/Network/Wai/Handler/Warp/HTTP1.hs +++ b/warp/Network/Wai/Handler/Warp/HTTP1.hs @@ -136,12 +136,10 @@ processRequest settings ii conn app th istatus src req mremainingRef idxhdr next return ResponseReceived case r of Right ResponseReceived -> return () - Left (e :: SomeException) - | Just (ExceptionInsideResponseBody e') <- fromException e -> throwIO e' - | otherwise -> do - keepAlive <- sendErrorResponse settings ii conn th istatus req e - settingsOnException settings (Just req) e - writeIORef keepAliveRef keepAlive + Left e -> do + keepAlive <- sendErrorResponse settings ii conn th istatus req e + settingsOnException settings (Just req) e + writeIORef keepAliveRef keepAlive keepAlive <- readIORef keepAliveRef diff --git a/warp/Network/Wai/Handler/Warp/Types.hs b/warp/Network/Wai/Handler/Warp/Types.hs index 442c06d13..b2a2f1452 100644 --- a/warp/Network/Wai/Handler/Warp/Types.hs +++ b/warp/Network/Wai/Handler/Warp/Types.hs @@ -60,20 +60,6 @@ instance UnliftIO.Exception InvalidRequest ---------------------------------------------------------------- --- | Exception thrown if something goes wrong while in the midst of --- sending a response, since the status code can't be altered at that --- point. --- --- Used to determine whether keeping the HTTP1.1 connection / HTTP2 stream alive is safe --- or irrecoverable. - -newtype ExceptionInsideResponseBody = ExceptionInsideResponseBody UnliftIO.SomeException - deriving (Show, Typeable) - -instance UnliftIO.Exception ExceptionInsideResponseBody - ----------------------------------------------------------------- - -- | Data type to abstract file identifiers. -- On Unix, a file descriptor would be specified to make use of -- the file descriptor cache.