Send 404 response properly

This commit is contained in:
Michael Snoyman 2010-04-11 13:05:40 -07:00
parent c181fd624e
commit 3f99bf132c

View File

@ -144,15 +144,14 @@ toWaiApp' y resource session env = do
types = httpAccept env types = httpAccept env
pathSegments = cleanupSegments resource pathSegments = cleanupSegments resource
eurl = parsePathSegments site pathSegments eurl = parsePathSegments site pathSegments
case eurl of render u = approot y ++ '/'
Left _ -> error "FIXME: send 404 message" : encodePathInfo (formatPathSegments site u)
Right url -> do
rr <- parseWaiRequest env session rr <- parseWaiRequest env session
onRequest y rr onRequest y rr
let render u = approot y ++ '/' let ya = case eurl of
: encodePathInfo (formatPathSegments site u) Left _ -> runHandler (errorHandler NotFound) y render
res <- handleSite site render url errorHandler rr types Right url -> handleSite site render url
responseToWaiResponse res ya errorHandler rr types >>= responseToWaiResponse
getMethod :: (String -> YesodApp y) -> YesodApp y getMethod :: (String -> YesodApp y) -> YesodApp y
getMethod f eh req cts = getMethod f eh req cts =