--- trunk/parse_format.pm 2003/03/15 21:33:36 40 +++ trunk/parse_format.pm 2003/03/22 22:43:05 43 @@ -6,10 +6,10 @@ use isis_sf; sub parse_format { - my $format = shift; - my $row = shift; + my $format = shift || die "parse_format must be called with format!"; + my $row = shift || die "parse_format must be called with row!"; my $i = shift || 0; # isis repeatable number - my $codepage = shift || die; + my $codepage = shift || die "parse_format must be called with codepage!"; my $out; my $out_swish; @@ -27,7 +27,12 @@ if ($format =~ s/^(\d\d\d)(\w?)//) { my $isis_tmp = isis_sf($row,$1,$2,$i); if ($isis_tmp) { - $isis_tmp = $codepage->convert($isis_tmp) if ($codepage); + eval { + $isis_tmp = $codepage->convert($isis_tmp) if ($codepage); + }; + if ($@) { + print STDERR "FATAL: something bad happend while trying to convert '$isis_tmp' [mfn: ",$row->{mfn},"]\n" + } $display .= $prefix . $isis_tmp; $swish .= $isis_tmp." "; #print STDERR " == $isis_tmp"; @@ -39,7 +44,12 @@ } elsif ($format =~ s/^(1[01])//) { my $isis_tmp = isis_sf($row,$1,undef,$i); if ($isis_tmp) { - $isis_tmp = $codepage->convert($isis_tmp) if ($codepage); + eval { + $isis_tmp = $codepage->convert($isis_tmp) if ($codepage); + }; + if ($@) { + print STDERR "FATAL: something bad happend while trying to convert '$isis_tmp' [mfn: ",$row->{mfn},"]\n" + } $display .= $prefix . $isis_tmp; $swish .= $isis_tmp." "; }