Protect DBIC as best we can from the failure mode in 7cb35852
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated / WithDSN.pm
index 46b1430..cb4ad2a 100644 (file)
@@ -4,7 +4,8 @@ use Moose::Role;
 use Scalar::Util 'reftype';
 requires qw/_query_start/;
 
-use Try::Tiny;
+use DBIx::Class::_Util 'dbic_internal_try';
+
 use namespace::clean -except => 'meta';
 
 =head1 NAME
@@ -33,7 +34,7 @@ Add C<DSN: > to debugging output.
 around '_query_start' => sub {
   my ($method, $self, $sql, @bind) = @_;
 
-  my $dsn = (try { $self->dsn }) || $self->_dbi_connect_info->[0];
+  my $dsn = (dbic_internal_try { $self->dsn }) || $self->_dbi_connect_info->[0];
 
   my($op, $rest) = (($sql=~m/^(\w+)(.+)$/),'NOP', 'NO SQL');
   my $storage_type = $self->can('active') ? 'REPLICANT' : 'MASTER';
@@ -42,7 +43,7 @@ around '_query_start' => sub {
     if ((reftype($dsn)||'') ne 'CODE') {
       "$op [DSN_$storage_type=$dsn]$rest";
     }
-    elsif (my $id = try { $self->id }) {
+    elsif (my $id = dbic_internal_try { $self->id }) {
       "$op [$storage_type=$id]$rest";
     }
     else {