[add html error messages daniel@phasevelocity.org**20090218071639 Ignore-this: 5d901a20c498f2cebd523b3ad2328595 This adds an 500 and a 404 page that are (slightly) more descriptive. fail inside WebT or ServerPartT now pops up an ISE page with the error description. ] hunk ./happstack-server/happstack-server.cabal 52 + Paths_happstack_server hunk ./happstack-server/src/Happstack/Server/SimpleHTTP.hs 205 +import qualified Paths_happstack_server as Cabal +import qualified Data.Version as DV hunk ./happstack-server/src/Happstack/Server/SimpleHTTP.hs 479 - deriving (Monad, MonadIO, Functor) - + deriving (MonadIO, Functor) + +instance Monad m => Monad (WebT m) where + m >>= f = WebT $ unWebT m >>= unWebT . f + return a = WebT $ return a + fail s = mkFailMessage s + hunk ./happstack-server/src/Happstack/Server/SimpleHTTP.hs 644 - standardNotFound = result 404 "No suitable handler found" + standardNotFound = setHeader "Content-Type" "text/html" $ toResponse notFoundHtml + hunk ./happstack-server/src/Happstack/Server/SimpleHTTP.hs 1327 + + +mkFailMessage s = do + ignoreFilters + internalServerError () + setHeaderM "Content-Type" "text/html" + res <- return $ toResponse $ failHtml s + finishWith $ res + +failHtml errString = "
Something went wrong here
"
+ ++ "Internal server error
"
+ ++ "Everything has stopped
The error was \"" ++ errString ++ "\"
" + where ver = DV.showVersion Cabal.version + +notFoundHtml = "Your file is not found
"
+ ++ "To try again is useless
"
+ ++ "It is just not here