summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-04-06 17:25:22 -0700
committerMark Wells <mark@freeside.biz>2015-04-06 17:29:50 -0700
commit6e083cee18cb70cfeea90eed475e452b2ff6a0f1 (patch)
tree3f8cff8449bec4ae4cd15bee82770b8392fc53c5
parent8bc03bf0c430decad33d72a2ab380ffbecb2cc87 (diff)
better error handling on U.S. Census geocoding, #32250
-rw-r--r--FS/FS/Misc/Geo.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index 7ab6d280d..40f30fea6 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -17,7 +17,7 @@ FS::UID->install_callback( sub {
$conf = new FS::Conf;
} );
-$DEBUG = 0;
+$DEBUG = 1;
@EXPORT_OK = qw( get_district );
@@ -334,8 +334,12 @@ sub standardize_uscensus {
censustract => $result->censustract,
};
} else {
- die "can't parse address '".$result->address."'";
+ die "Geocoding returned '".$result->address."', which does not seem to be a valid address.\n";
}
+ } elsif ( $result->match_level eq 'Tie' ) {
+ die "Geocoding was not able to identify a unique matching address.\n";
+ } elsif ( $result->match_level ) {
+ die "Geocoding did not find a matching address.\n";
} else {
warn Dumper($result) if $DEBUG;
die $result->error_message;