Better signature for errorHandler
This commit is contained in:
parent
949e3bff2f
commit
ac8d0fb800
@ -251,14 +251,14 @@ toWaiApp' y segments env = do
|
|||||||
onRequest y rr
|
onRequest y rr
|
||||||
let h =
|
let h =
|
||||||
case eurl of
|
case eurl of
|
||||||
Left _ -> errorHandler y NotFound
|
Left _ -> errorHandler NotFound
|
||||||
Right url -> do
|
Right url -> do
|
||||||
-- FIXME auth <- isAuthorized y url
|
-- FIXME auth <- isAuthorized y url
|
||||||
case handleSite site render url method of
|
case handleSite site render url method of
|
||||||
Nothing -> errorHandler y $ BadMethod method
|
Nothing -> errorHandler $ BadMethod method
|
||||||
Just h' -> h'
|
Just h' -> h'
|
||||||
let eurl' = either (const Nothing) Just eurl
|
let eurl' = either (const Nothing) Just eurl
|
||||||
let eh er = runHandler (errorHandler y er) render eurl' id y id
|
let eh er = runHandler (errorHandler er) render eurl' id y id
|
||||||
let ya = runHandler h render eurl' id y id
|
let ya = runHandler h render eurl' id y id
|
||||||
(s, hs, ct, c, sessionFinal) <- unYesodApp ya eh rr types
|
(s, hs, ct, c, sessionFinal) <- unYesodApp ya eh rr types
|
||||||
let sessionVal = encodeSession key' exp' host sessionFinal
|
let sessionVal = encodeSession key' exp' host sessionFinal
|
||||||
|
|||||||
@ -69,11 +69,8 @@ class Yesod a where
|
|||||||
clientSessionDuration = const 120
|
clientSessionDuration = const 120
|
||||||
|
|
||||||
-- | Output error response pages.
|
-- | Output error response pages.
|
||||||
errorHandler :: Yesod y
|
errorHandler :: ErrorResponse -> GHandler sub a ChooseRep
|
||||||
=> a
|
errorHandler = defaultErrorHandler
|
||||||
-> ErrorResponse
|
|
||||||
-> Handler y ChooseRep
|
|
||||||
errorHandler _ = defaultErrorHandler
|
|
||||||
|
|
||||||
-- | Applies some form of layout to the contents of a page.
|
-- | Applies some form of layout to the contents of a page.
|
||||||
defaultLayout :: PageContent (Routes a) -> GHandler sub a Content
|
defaultLayout :: PageContent (Routes a) -> GHandler sub a Content
|
||||||
@ -167,9 +164,7 @@ applyLayout' :: Yesod master
|
|||||||
applyLayout' s = fmap chooseRep . applyLayout s mempty
|
applyLayout' s = fmap chooseRep . applyLayout s mempty
|
||||||
|
|
||||||
-- | The default error handler for 'errorHandler'.
|
-- | The default error handler for 'errorHandler'.
|
||||||
defaultErrorHandler :: Yesod y
|
defaultErrorHandler :: Yesod y => ErrorResponse -> GHandler sub y ChooseRep
|
||||||
=> ErrorResponse
|
|
||||||
-> Handler y ChooseRep
|
|
||||||
defaultErrorHandler NotFound = do
|
defaultErrorHandler NotFound = do
|
||||||
r <- waiRequest
|
r <- waiRequest
|
||||||
applyLayout' "Not Found" $ [$hamlet|
|
applyLayout' "Not Found" $ [$hamlet|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user