From: Matt S Trout Date: Sat, 1 Apr 2006 00:10:06 +0000 (+0000) Subject: Storage::DBI error reporting improvement from Dan Sully X-Git-Tag: v0.06001~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=95dad7e278dc0975e524dc7c5a324b3944ec7bc3;p=dbsrgits%2FDBIx-Class.git Storage::DBI error reporting improvement from Dan Sully --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 7058f0b..efefa1a 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -481,8 +481,11 @@ sub _execute { @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args my $rv; if ($sth) { - $rv = $sth->execute(@bind) - or $self->throw_exception("Error executing '$sql': " . $sth->errstr); + $rv = eval { $sth->execute(@bind) }; + + if ($@ || !$rv) { + $self->throw_exception("Error executing '$sql': ".($@ || $sth->errstr)); + } } else { $self->throw_exception("'$sql' did not generate a statement."); }