Skip to content

Commit

Permalink
mib-parser: pass through error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Gelf committed Dec 1, 2017
1 parent edb6197 commit 59a7b06
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions contrib/mib-parser.pl
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,20 @@ BEGIN
delete $mib->{'stream'};
$fh->close;

use JSON;

unless ($r) {
print "Unable to parse MIB\n";
my $err = "Unable to parse MIB:";
foreach my $msg (@{$mib->{'msg'}}) {
$err .= ' ' . $msg->{'msg'};
}
print "$err\n";
# print "Unable to parse MIB: " . join(', ', @{$mib->{'msg'}}) . "\n";
exit(1);
}

$mib->create_tree();

use JSON;
print to_json {
'name' => $mib->{'name'},
'imports' => $mib->{'imports'},
Expand Down

0 comments on commit 59a7b06

Please sign in to comment.