throw error including SQL statement for failed $sth->execute
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI.pm
index 015fa3e..e733b53 100644 (file)
@@ -436,7 +436,7 @@ sub _execute {
   @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args
   my $rv;
   if ($sth) {  
-    $rv = $sth->execute(@bind);
+    $rv = $sth->execute(@bind) or $self->throw_exception("Error executing '$sql': " . $sth->errstr);
   } else { 
     $self->throw_exception("'$sql' did not generate a statement.");
   }