Handle non existing group error

Zendesk: https://gitlab.zendesk.com/agent/tickets/14203
GitLab: 8.3.0

Observed Behavior

When trying to reach a non existing group through URI the server responds with a 500 error.

Expected Behavior

User should be served a No Group Found flash message or 404 page.

Error Logs

Started GET "/groups/hlnl" for 181.174.107.82 at 2015-12-30 16:14:59 -0500
Processing by GroupsController#show as HTML
  Parameters: {"id"=>"hlnl"}
Completed 500 Internal Server Error in 131ms (ActiveRecord: 10.8ms)

NoMethodError (undefined method `shared_projects' for nil:NilClass):
  app/controllers/groups_controller.rb:44:in `show'

Next Steps

  • Look into the best way of raising and handling and exception for this case.

/cc @JobV