avoid dying on relationship conflicts
Tara L Andrews [Thu, 19 Apr 2012 09:47:55 +0000 (11:47 +0200)]
lib/Text/Tradition/Parser/Self.pm

index b8f12dd..432d8a3 100644 (file)
@@ -3,6 +3,7 @@ package Text::Tradition::Parser::Self;
 use strict;
 use warnings;
 use Text::Tradition::Parser::GraphML qw/ graphml_parse /;
+use TryCatch;
 
 =head1 NAME
 
@@ -224,7 +225,11 @@ sub parse {
                                $rel_exists = 1;
                        }
                }
-               $collation->add_relationship( $from, $to, $e ) unless $rel_exists;
+               try {
+                       $collation->add_relationship( $from, $to, $e ) unless $rel_exists;
+               } catch( Text::Tradition::Error $e ) {
+                       warn "DROPPING $from -> $to: " . $e->message;
+               }
        }
        
     # Save the text for each witness so that we can ensure consistency