From: Brandon L Black Date: Fri, 10 Nov 2006 00:17:50 +0000 (+0000) Subject: slightly better exception message (inf loop stuff) X-Git-Tag: 0.06~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa27b31660f41559d902d3e447714355e00ee16e;p=gitmo%2FAlgorithm-C3.git slightly better exception message (inf loop stuff) --- diff --git a/lib/Algorithm/C3.pm b/lib/Algorithm/C3.pm index 5e65d3a..7e96573 100644 --- a/lib/Algorithm/C3.pm +++ b/lib/Algorithm/C3.pm @@ -29,7 +29,12 @@ sub merge { while(1) { if($i < @$current_parents) { my $new_root = $current_parents->[$i++]; - die "Infinite loop detected" if $seen{$new_root}; + + if($seen{$new_root}) { + # XXX Can we give them a better diagnostic, with a list from $root => $new_root => foo => $new_root ?? + die "Infinite loop detected, $new_root appears" + . " twice in a bad way in the parents of $root" + } $seen{$new_root} = 1; unless ($pfetcher_is_coderef or $new_root->can($parent_fetcher)) {