- better error reporing from OpenIsis
[webpac] / all2xml.pl
index 8f0e41a..56daf87 100755 (executable)
@@ -293,8 +293,9 @@ print STDERR "reading ./import_xml/$type.xml\n";
 
        # output current progress indicator
        my $last_p = 0;
+print STDERR "## show_progress: $show_progress ##\n"; # XXX
        sub progress {
-               # XXX return if ($show_progress ne "");
+               return if (! $show_progress);
                my $current = shift;
                my $total = shift || 1;
                my $p = int($current * 100 / $total);
@@ -327,6 +328,19 @@ print STDERR "using: $type...\n";
                $import2cp = Text::Iconv->new($config->{isis_codepage},$codepage);
                my $db = OpenIsis::open( $isis_db );
 
+               # OpenIsis::ERR_BADF 
+               if ($db == -4) {
+                       print STDERR "FATAL: OpenIsis can't find file $isis_db\n";
+                       next;
+               # OpenIsis::ERR_IO
+               } elsif ($db == -5) {
+                       print STDERR "FATAL: OpenIsis can't access file $isis_db\n";
+                       next;
+               } elsif ($db < 0) {
+                       print STDERR "FATAL: OpenIsis unknown error $db with file $isis_db\n";
+                       next;
+               }
+
                my $max_rowid = OpenIsis::maxRowid( $db );
 
                print STDERR "Reading database: $isis_db [$max_rowid rows]\n";