Skip to content

Commit

Permalink
Better message on dbpedia connection failure
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Dec 29, 2023
1 parent 48814e8 commit 0defab7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -12439,8 +12439,9 @@ sub dbpedia
$surname = 'NULL';
}

print "https://lookup.dbpedia.org/api/search?query=$firstname%20$surname\n" if($opts{'v'});
if(($firstname ne '?') && (my $resp = $cached_browser->get("https://lookup.dbpedia.org/api/search?query=$firstname%20$surname"))) {
my $url = "https://lookup.dbpedia.org/api/search?query=$firstname%20$surname";
print "$url\n" if($opts{'v'});
if(($firstname ne '?') && (my $resp = $cached_browser->get($url))) {
if($resp->is_success()) {
if(my $arrayofresults = XML::Hash->new()->fromXMLStringtoHash($resp->decoded_content())->{'ArrayOfResults'}) {
RESULT: foreach my $result(@{$arrayofresults->{'Result'}}) {
Expand Down Expand Up @@ -12606,7 +12607,7 @@ sub dbpedia
}
}
} else {
complain({ person => $person, warning => "dbpedia: $firstname $surname failed: " . $resp->status_line() });
complain({ person => $person, warning => "$url: $firstname $surname failed: " . $resp->status_line() });
}
}
}
Expand Down

0 comments on commit 0defab7

Please sign in to comment.