From: Rafael Kitover Date: Sun, 24 Jun 2012 17:42:46 +0000 (-0400) Subject: fix silent Oracle connection failures X-Git-Tag: v0.08198~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=461c7168e4cfe3bb59d0ef8b4b05a1b009f6b4ad;p=dbsrgits%2FDBIx-Class.git fix silent Oracle connection failures ::Storage::DBI::_server_info was eating connection exceptions by ignoring exceptions from $dbh->get_info, but this information is important for _rebless when e.g. determining which class to use based on the DB server version, so rethrow the exceptions when $self->{_in_determine_driver} is true. --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 45afefc..846bcca 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1075,7 +1075,16 @@ sub _server_info { $info = {}; - my $server_version = try { $self->_get_server_version }; + my $server_version; + try { + $server_version = $self->_get_server_version; + } + catch { + if ($self->{_in_determine_driver}) { + $self->throw_exception($_); + } + $server_version = undef; + }; if (defined $server_version) { $info->{dbms_version} = $server_version; @@ -1119,7 +1128,19 @@ sub _dbh_get_info { unless defined $info; } - return try { $self->_get_dbh->get_info($info) } || undef; + my $res; + + try { + $res = $self->_get_dbh->get_info($info); + } + catch { + if ($self->{_in_determine_driver}) { + $self->throw_exception($_); + } + $res = undef; + }; + + return $res; } sub _determine_driver {