diff options
author | Struan Donald <struan@exo.org.uk> | 2011-10-21 15:01:27 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-10-21 15:01:27 +0100 |
commit | 9a4ce022e13ed57d89851a6351a5b95b9566e12b (patch) | |
tree | d6eb6a4edf1c8c23d0fcd21c6f01e1f3d5d898b6 | |
parent | 2d759ea59de094614a7241a50e2874c09f2a83c4 (diff) |
return an error if we cannot find the location rather than just bailing
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 11 |
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 = ''; |