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 ya = case eurl of
let render u = approot y ++ '/' Left _ -> runHandler (errorHandler NotFound) y render
: encodePathInfo (formatPathSegments site u) Right url -> handleSite site render url
res <- handleSite site render url errorHandler rr types ya errorHandler rr types >>= responseToWaiResponse
responseToWaiResponse res
getMethod :: (String -> YesodApp y) -> YesodApp y getMethod :: (String -> YesodApp y) -> YesodApp y
getMethod f eh req cts = getMethod f eh req cts =