aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-10-21 15:01:27 +0100
committerStruan Donald <struan@exo.org.uk>2011-10-21 15:01:27 +0100
commit9a4ce022e13ed57d89851a6351a5b95b9566e12b (patch)
treed6eb6a4edf1c8c23d0fcd21c6f01e1f3d5d898b6
parent2d759ea59de094614a7241a50e2874c09f2a83c4 (diff)
return an error if we cannot find the location rather than just bailing
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 4419ecd92..c6ede88f7 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -132,7 +132,16 @@ sub category_extras_ajax : Path('category_extras') : Args(0) {
my ( $self, $c ) = @_;
$c->forward('initialize_report');
- $c->forward('determine_location') or return 0;
+ if ( ! $c->forward('determine_location') ) {
+ my $body = JSON->new->utf8(1)->encode(
+ {
+ error => _("Sorry, we could not find that location."),
+ }
+ );
+ $c->res->content_type('application/json; charset=utf-8');
+ $c->res->body($body);
+ return 1;
+ }
$c->forward('setup_categories_and_councils');
my $category_extra = '';