throw error including SQL statement for failed $sth->execute
Will Hawes [Mon, 6 Mar 2006 16:34:42 +0000 (16:34 +0000)]
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.");
   }