Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improve error message on failed configuration. #135

Merged
merged 1 commit into from

2 participants

petterreinholdtsen mySociety
petterreinholdtsen

While trying to get the Catalyst version running, I ran into a few hard to understand problems. This error handling change will make it easier to understand that the problem is incorrect MAPIT server setting
and the fact that a cron job have not been run yet.

mySociety mysociety merged commit b4166c5 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 5 deletions.
  1. +14 −5 perllib/FixMyStreet/App/Controller/Reports.pm
19 perllib/FixMyStreet/App/Controller/Reports.pm
View
@@ -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';
}
}
Something went wrong with that request. Please try again.