[Jifty-commit] jifty-dbi branch, master, updated. 0.69-2-gb570ddb

Jifty commits jifty-commit at lists.jifty.org
Wed Jun 8 10:40:12 EDT 2011


The branch, master has been updated
       via  b570ddb778b4db2f780ec0eeed1e9f85f9754599 (commit)
      from  95609b74889ef9b9c7b1fc1d3722cd8a0233bd48 (commit)

Summary of changes:
 lib/Jifty/DBI/Handle.pm |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit b570ddb778b4db2f780ec0eeed1e9f85f9754599
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jun 8 10:38:26 2011 -0400

    Produce a useful error message when we can't execute the statement
    
    This makes the error message consistent across the die/warn and return
    value, and ensures it always includes the relevant details of the error.
    
    Additionally, since we're also trapping eval errors, use the $@ message
    if the handle's errstr is empty.

diff --git a/lib/Jifty/DBI/Handle.pm b/lib/Jifty/DBI/Handle.pm
index a5c7cc6..85c1d79 100755
--- a/lib/Jifty/DBI/Handle.pm
+++ b/lib/Jifty/DBI/Handle.pm
@@ -584,21 +584,21 @@ sub simple_query {
     }
 
     if ( $@ or !$executed ) {
-        if ($DEBUG) {
-            die "$self couldn't execute the query '$query_string'"
-                . $self->dbh->errstr . "\n";
+        my $message = "$self couldn't execute the query '$query_string': "
+                        . ($self->dbh->errstr || $@);
 
+        if ($DEBUG) {
+            die "$message\n";
         } else {
 
  # XXX: This warn doesn't show up because we mask logging in Jifty::Test::END.
  # and it usually fails because the test server is still running.
-            warn "$self couldn't execute the query '$query_string'";
+            warn "$message\n";
 
             my $ret = Class::ReturnValue->new();
             $ret->as_error(
                 errno   => '-1',
-                message => "Couldn't execute the query '$query_string'"
-                    . $self->dbh->errstr,
+                message => $message,
                 do_backtrace => undef
             );
             return ( $ret->return_value );

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list