Enhanced error messages.

parent 650a2f21
......@@ -46,14 +46,14 @@ appInit = makeSnaplet "roguestar-server-snaplet" "Roguestar Server" Nothing $
("/play", play),
("/static", static),
("/fail404", handle404),
("/fail500", handle500 (do error "my brain exploded")),
("/fail500", handle500 (do error "this is an error message")),
("/feedback", postFeedback),
("/feedback-thanks", staticTemplate "static/templates/feedback-thanks.mustache"),
("/feedback-thanks", method GET $ ifTop $ staticTemplate "static/templates/feedback-thanks.mustache"),
("/options", options),
("", staticTemplate "static/templates/index.mustache")]
("/", method GET $ ifTop $ staticTemplate "static/templates/index.mustache")]
config <- liftIO $ getConfiguration default_timeout
game <- liftIO $ createGameState config
wrapSite (<|> handle404)
wrapSite (\site -> site <|> handle404)
wrapSite handle500
return $ App game the_globals
......@@ -72,6 +72,7 @@ handle500 m = (m >> return ()) `CatchIO.catch` \(e::SomeException) -> do
writeText "<html><head><title>oh noes</title></head>"
writeText "<body style=\"background:black; color:white;\"><h1>theirs a porblem</h1>"
writeText "<p>i'm so sorry the website broke a little</p>"
writeText "<p>maybe you should file a <a href=\"/options#feedback\">complaint</a></p>"
writeText "<img src=\"static/art/TabularMonstrosity.svg\"/>"
writeText "<pre>\n"
writeLazyText $ htmlEscape t
......@@ -96,7 +97,7 @@ static :: Handler App App ()
static = serveDirectoryWith static_directory_config "./static/"
staticTemplate :: FilePath -> Handler App App ()
staticTemplate filepath = method GET $ ifTop $
staticTemplate filepath =
do globals <- getBasicState
renderThemedPage filepath $ object [
"static" .= True,
......
......@@ -3,7 +3,7 @@
<div id="documenttext" class="roguebox">
<h1>404 Not Found</h1>
<p>You has a sad roguestar :(</p>
<p>Your web browser asked for a thing, but it wasn't here. Maybe you should <a href="/options#feedback">complain</a>?</p>
</div>
{{> footer}}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment