dnsexit2: Don't croak if JSON decoding fails
This commit is contained in:
parent
d28c8ea7ad
commit
24a22092ca
1 changed files with 5 additions and 1 deletions
|
@ -4216,7 +4216,11 @@ sub nic_dnsexit2_update {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
my $body = ($reply =~ s/^.*?\r?\n\r?\n//sr);
|
my $body = ($reply =~ s/^.*?\r?\n\r?\n//sr);
|
||||||
my $response = decode_json($body);
|
my $response = eval { decode_json($body); };
|
||||||
|
if (!$response) {
|
||||||
|
failed("failed to parse response: $@");
|
||||||
|
next;
|
||||||
|
}
|
||||||
if (!defined($response->{'code'}) || !defined($response->{'message'})) {
|
if (!defined($response->{'code'}) || !defined($response->{'message'})) {
|
||||||
failed("Did not receive expected \"code\" and \"message\" keys in server response.");
|
failed("Did not receive expected \"code\" and \"message\" keys in server response.");
|
||||||
failed("Response:");
|
failed("Response:");
|
||||||
|
|
Loading…
Reference in a new issue