Skip to content
Snippets Groups Projects
Commit 858dc42c authored by Andy Yates's avatar Andy Yates
Browse files

Bit of error checking/throwing put in to stop bad file system paths from being...

Bit of error checking/throwing put in to stop bad file system paths from being produced when we lack a CS version
parent 63bad63a
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,8 @@ sub new_fast {
path to the file or a URL but it is up to the using code to
know how to interprate the different returned forms
Returntype : Scalar the absolute path/url to the given resource
Exceptions : None
Exceptions : Thrown if the linked Coordinate System lacks a version and the
current database also lacks a default version
Caller : public
=cut
......@@ -92,15 +93,20 @@ sub path {
if(! $base) {
throw 'No base given';
}
my $production_name = $self->adaptor()->db()->get_MetaContainer()->get_production_name();
my $cs_version = $self->coord_system()->version();
if(! $cs_version) {
my ($highest_cs) = @{$self->adaptor()->db()->get_CoordSystemAdaptor()->fetch_all()};
$cs_version = $highest_cs->version();
}
if(!$cs_version) {
my $name = $self->name();
throw "The file '${name}' in species '${$production_name} is attached to a CoordinateSystem lacking a version and has no default assembly. Please fix";
}
my @portions;
push(@portions, $self->adaptor()->db()->get_MetaContainer()->get_production_name());
push(@portions, $production_name);
push(@portions, $self->coord_system()->version());
push(@portions, software_version()) if $self->version_lock();
push(@portions, $self->adaptor()->db()->group());
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment