Fix incorrect exception propagation in ::Replicated::execute_reliably
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated.pm
index 73998d2..512c53e 100644 (file)
@@ -693,19 +693,13 @@ sub execute_reliably {
   my $self = shift;
   my $coderef = shift;
 
-  unless( ref $coderef eq 'CODE') {
-    $self->throw_exception('Second argument must be a coderef');
-  }
+  $self->throw_exception('Second argument must be a coderef')
+    unless( ref $coderef eq 'CODE');
 
   ## replace the current read handler for the remainder of the scope
   local $self->{read_handler} = $self->master;
 
-  my $args = \@_;
-  return dbic_internal_try {
-    $coderef->(@$args);
-  } catch {
-    $self->throw_exception("coderef returned an error: $_");
-  };
+  &$coderef;
 }
 
 =head2 set_reliable_storage