Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

show a nicer error page if your player isn't there

  • Loading branch information...
commit 8953f227b6f04b87d79b56fb694af27e69533093 1 parent aac021a
@rchatley authored
View
5 features/step_definitions/team_steps.rb
@@ -54,3 +54,8 @@
Then /^the game master should not send me anymore questions$/ do
app.players_threads.should be_empty
end
+
+Then /^my player page should give a nice error$/ do
+ visit '/players/no-longer-exists'
+ page.should have_content("No player is registered with that id")
+end
View
1  features/withdraw.feature
@@ -7,4 +7,5 @@ Feature: A team can withdraw from the game
Given I am playing
When I withdraw
Then my name should not be on the leaderboard anymore
+ And my player page should give a nice error
And the game master should not send me anymore questions
View
14 lib/extreme_startup/web_server.rb
@@ -81,11 +81,15 @@ def to_json(*a)
end
get %r{/players/([\w]+)} do |uuid|
- haml :personal_page, :locals => {
- :name => players[uuid].name,
- :playerid => uuid,
- :score => scoreboard.scores[uuid],
- :log => players[uuid].log[0..25] }
+ if (players[uuid] == nil)
+ haml :no_such_player
+ else
+ haml :personal_page, :locals => {
+ :name => players[uuid].name,
+ :playerid => uuid,
+ :score => scoreboard.scores[uuid],
+ :log => players[uuid].log[0..25] }
+ end
end
get '/players' do
View
9 views/no_such_player.haml
@@ -0,0 +1,9 @@
+%html
+ %head
+ %title Extreme Startup - No Such Player
+ %link(rel="stylesheet" href="/css/style.css")
+ %body
+ %h1 No Such Player
+
+ %p
+ No player is registered with that id. Perhaps the game was restarted? You may need to re-register.

0 comments on commit 8953f22

Please sign in to comment.
Something went wrong with that request. Please try again.