Skip to content

Commit

Permalink
Bio::Index::Abstract->_type_and_version: check type before version (i…
Browse files Browse the repository at this point in the history
…ssue #281)

Because each index uses its own version number, there's no point in
checking the version number before we know the type is correct.  So
test type first, and only then test the version number.
  • Loading branch information
carandraug committed Sep 15, 2018
1 parent 280b4bf commit 37aa9f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Bio/Index/Abstract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,10 @@ sub _type_and_version {
# Run check or add type and version key if missing
if (my $rec = $self->db->{ $key }) {
my( $db_type, $db_version ) = $self->unpack_record($rec);
$self->throw("This index file is from version [$db_version] - You need to rebuild it to use module version [$version]")
unless $db_version == $version;
$self->throw("This index file is type [$db_type] - Can't access it with module for [$type]")
unless $db_type eq $type;
$self->throw("This index file is from version [$db_version] - You need to rebuild it to use module version [$version]")
unless $db_version == $version;
} else {
$self->add_record( $key, $type, $version )
or $self->throw("Can't add Type and Version record");
Expand Down

0 comments on commit 37aa9f0

Please sign in to comment.