From 22ed7532df84a4c59a4f919ea598de615200907a Mon Sep 17 00:00:00 2001
From: Andrew Yates <ayates@ebi.ac.uk>
Date: Thu, 2 Sep 2010 16:24:56 +0000
Subject: [PATCH] Code originally allowed a user to not specify a DBConncetion
 during construction. This is not the right behaviour and has now been tidied
 up

---
 modules/Bio/EnsEMBL/Utils/SqlHelper.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/Bio/EnsEMBL/Utils/SqlHelper.pm b/modules/Bio/EnsEMBL/Utils/SqlHelper.pm
index 43ef3fbaa8..ba4f0b6ec8 100644
--- a/modules/Bio/EnsEMBL/Utils/SqlHelper.pm
+++ b/modules/Bio/EnsEMBL/Utils/SqlHelper.pm
@@ -94,7 +94,8 @@ use Scalar::Util qw(weaken); #Used to not hold a strong ref to DBConnection
 
   Arg [DB_CONNECTION] : DBConnection instance to use
   Returntype          : Instance of helper
-  Exceptions          : If the object given as a DBConnection is not one
+  Exceptions          : If the object given as a DBConnection is not one or it
+                        was undefined
   Status              : Stable
 
 Creates a new instance of this object.
@@ -111,6 +112,8 @@ sub new {
 	my ($db_connection) = rearrange([qw(db_connection)], @args);
 	 
 	my $self = bless( {}, ref($class) || $class );
+	throw('-DB_CONNECTION construction parameter was undefined.') 
+	 unless defined $db_connection;
 	$self->db_connection($db_connection);
 	
 	return $self;
@@ -118,6 +121,8 @@ sub new {
 
 =pod
 
+=head2 db_connection()
+
   Arg [1]     : DBConnection instance to use
   Description : Sets and retrieves the DBConnection 
   Returntype  : DBConnection if set; otherwise undef
-- 
GitLab