enhance cisco apic error handle

This commit is contained in:
garnier-quentin 2019-12-04 15:41:50 +01:00
parent 35666af8ff
commit cdaffded89
1 changed files with 1 additions and 1 deletions

View File

@ -214,7 +214,7 @@ sub request_api {
$self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@");
$self->{output}->option_exit();
}
if (defined($decoded->{imdata}->[0]->{error}->{attributes})) {
if (defined($decoded->{imdata}->[0]) && defined($decoded->{imdata}->[0]->{error}->{attributes})) {
$self->{output}->add_option_msg(short_msg => "Error '" . uc($decoded->{imdata}->[0]->{error}->{attributes}->{code}) . " " . $decoded->{imdata}->[0]->{error}->{attributes}->{text} . "'");
$self->{output}->option_exit();
}