unless ($zresponse->{command}{response}{success} && $zresponse->{command}{response}{success} eq 'true') {
my $errorstr = '';
if ($zresponse->{command}{error}) {
- my @error = @{ from_json($res->content)->{command}{error} };
- foreach my $e (@error) {
+ my $error = $zresponse->{command}{error};
+ if (ref($error) eq 'HASH') {
+ $error = [ $error ];
+ }
+ foreach my $e (@{$error}) {
if (ref($e) eq 'HASH') {
foreach my $key (keys %$e) {
if ($key ne '@attributes') {
- $errorstr .= $e->{$key};
+ $errorstr .= "$key: $e->{$key}";
}
}
}