on master help sign in
Merge pull request #326 from romanb/bugfix/missing-request-on-exception
9642039Michael Snoyman
warp/Network/Wai/Handler/Warp/Run.hs+7
@@ -339,6 +339,13 @@ serveConnection conn ii origAddr isSecure' settings app = do
339 recvSendLoop addr istatus fromClient = do
339 recvSendLoop addr istatus fromClient = do
340 (req', mremainingRef, idxhdr) <- recvRequest settings conn ii addr fromClient
340 (req', mremainingRef, idxhdr) <- recvRequest settings conn ii addr fromClient
341 let req = req' { isSecure = isSecure' }
341 let req = req' { isSecure = isSecure' }
342+ processRequest addr istatus fromClient req mremainingRef idxhdr
343+ `catch` \e -> do
344+ -- Call the user-supplied exception handlers, passing the request.
345+ sendErrorResponse addr istatus e
346+ onE settings (Just req) e
347+
348+ processRequest addr istatus fromClient req mremainingRef idxhdr = do
342 -- Let the application run for as long as it wants
349 -- Let the application run for as long as it wants
343 T.pause th
350 T.pause th
344
351