diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-07-12 14:31:18 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-07-12 14:31:18 +0100 |
commit | b058accf4a423d8c3ca4469f044ee2dc00f107dd (patch) | |
tree | 2885d9734426549c7a693e06d7d8a1c35fc5b09b | |
parent | 8b5e260b1c3841fcf0731682f0638e4b52f653a7 (diff) | |
parent | b4166c5a0381303413df39b4a5f37c5923d0737c (diff) |
Merge commit 'petter/catalyst-improve-error'
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 98a3c8927..61d7d5cb1 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -34,10 +34,18 @@ sub index : Path : Args(0) { $c->response->header('Cache-Control' => 'max-age=3600'); # Fetch all areas of the types we're interested in - my @area_types = $c->cobrand->area_types; - my $areas_info = mySociety::MaPit::call('areas', \@area_types, - min_generation => $c->cobrand->area_min_generation - ); + my $areas_info; + eval { + my @area_types = $c->cobrand->area_types; + $areas_info = mySociety::MaPit::call('areas', \@area_types, + min_generation => $c->cobrand->area_min_generation + ); + }; + if ($@) { + $c->stash->{message} = _("Unable to look up areas in MaPit. Please try again later.") . ' ' . + sprintf(_('The error was: %s'), $@); + $c->stash->{template} = 'errors/generic.html'; + } # For each area, add its link and perhaps alter its name if we need to for # places with the same name. @@ -61,7 +69,8 @@ sub index : Path : Args(0) { $c->stash->{open} = $j->{open}; }; if ($@) { - $c->stash->{message} = _("There was a problem showing the All Reports page. Please try again later."); + $c->stash->{message} = _("There was a problem showing the All Reports page. Please try again later.") . ' ' . + sprintf(_('The error was: %s'), $@); $c->stash->{template} = 'errors/generic.html'; } } |