aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew>2008-10-21 23:59:32 +0000
committermatthew <matthew>2008-10-21 23:59:32 +0000
commit491ede9904a121de08d16cb1937c8c475097043e (patch)
tree0e055a7884eb92ced6376be59927dc9f82c2702f
parentc9f7ec5e74f4edc029108951bfdb396932260644 (diff)
I always forget to include the Error module; try{} the co-ordinate changing
in case it goes wrong (outside the UK).
-rwxr-xr-xweb/import.cgi10
1 files changed, 8 insertions, 2 deletions
diff --git a/web/import.cgi b/web/import.cgi
index 4db1ef723..663db54f4 100755
--- a/web/import.cgi
+++ b/web/import.cgi
@@ -6,9 +6,10 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: import.cgi,v 1.2 2008-10-20 12:35:20 matthew Exp $
+# $Id: import.cgi,v 1.3 2008-10-21 23:59:32 matthew Exp $
use strict;
+use Error qw(:try);
use Standard;
use mySociety::AuthToken;
use mySociety::Email;
@@ -47,7 +48,12 @@ sub main {
}
if ($input{lat}) {
- ($input{easting}, $input{northing}) = mySociety::GeoUtil::wgs84_to_national_grid($input{lat}, $input{lon}, 'G');
+ try {
+ ($input{easting}, $input{northing}) = mySociety::GeoUtil::wgs84_to_national_grid($input{lat}, $input{lon}, 'G');
+ } catch Error::Simple with {
+ my $e = shift;
+ push @errors, "We had a problem with the supplied co-ordinates - outside the UK?";
+ };
}
# TODO: Get location from photo if present in EXIF data?