summaryrefslogtreecommitdiff
path: root/FS/FS/Misc
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-12-22 17:03:07 -0800
committerMark Wells <mark@freeside.biz>2015-12-22 17:06:44 -0800
commitc8f4149f2dc5a1f593a6ba422181c3d433cc6ef7 (patch)
tree1133aaa1a6c7abb750583aaba890ccfbf06ad938 /FS/FS/Misc
parent3f7f6b5fa717facf9c63edc480071debfc02a33a (diff)
improve handling of internal errors from US Census geocoding, #39549
Diffstat (limited to 'FS/FS/Misc')
-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 e83d6dc..aa4e55e 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -11,6 +11,7 @@ use Cpanel::JSON::XS;
use URI::Escape 3.31;
use Data::Dumper;
use FS::Conf;
+use FS::Log;
use Locale::Country;
FS::UID->install_callback( sub {
@@ -300,6 +301,8 @@ sub standardize_usps {
sub standardize_uscensus {
my $self = shift;
my $location = shift;
+ my $log = FS::Log->new('FS::Misc::Geo::standardize_uscensus');
+ $log->debug(join("\n", @{$location}{'address1', 'city', 'state', 'zip'}));
eval "use Geo::USCensus::Geocoding";
die $@ if $@;
@@ -322,6 +325,7 @@ sub standardize_uscensus {
my $result = Geo::USCensus::Geocoding->query($request);
if ( $result->is_match ) {
# unfortunately we get the address back as a single line
+ $log->debug($result->address);
if ($result->address =~ /^(.*), (.*), ([A-Z]{2}), (\d{5}.*)$/) {
return +{
address1 => $1,
@@ -341,8 +345,8 @@ sub standardize_uscensus {
} elsif ( $result->match_level ) {
die "Geocoding did not find a matching address.\n";
} else {
- warn Dumper($result) if $DEBUG;
- die $result->error_message;
+ $log->error($result->error_message);
+ return; # for internal errors, don't return anything
}
}