diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2011-07-12 14:23:00 +0200 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2011-07-12 14:23:00 +0200 |
commit | b4166c5a0381303413df39b4a5f37c5923d0737c (patch) | |
tree | ff898510fb2327c1bfa1915114551ee5126ee2d7 | |
parent | e10df38e15cda1c4351eea7b260739cbd038b423 (diff) |
Improve error message on failed configuration.
-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 8cebc0e60..cfabb4dfd 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'; } } |