on master help sign in
Merge pull request #326 from romanb/bugfix/missing-request-on-exception

Pass the Request to settingsOnException handlers when available.

commit9642039e5426d4b29db1beca44b0e85883d6e0d0 authorMichael Snoyman <michael@snoyman.com> dateWed 14 Jan 2015, 08:20 (12 years ago) parent53856a54b97050
1 file changed+7
warp/Network/Wai/Handler/Warp/Run.hs+7
warp/Network/Wai/Handler/Warp/Run.hs+7
@@ -339,6 +339,13 @@ serveConnection conn ii origAddr isSecure' settings app = do
339339 recvSendLoop addr istatus fromClient = do
340340 (req', mremainingRef, idxhdr) <- recvRequest settings conn ii addr fromClient
341341 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
342349 -- Let the application run for as long as it wants
343350 T.pause th
344351