[Jifty-commit] r6915 - Jifty-DBI/trunk/lib/Jifty/DBI

Jifty commits jifty-commit at lists.jifty.org
Wed Apr 29 16:31:04 EDT 2009


Author: sartak
Date: Wed Apr 29 16:31:03 2009
New Revision: 6915

Modified:
   Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm

Log:
Improve SQL error message and avoid its duplication

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm	Wed Apr 29 16:31:03 2009
@@ -525,17 +525,16 @@
 
     my $sth = $self->dbh->prepare($query_string);
     unless ($sth) {
+        my $message = "$self couldn't prepare the query '$query_string': "
+                    . $self->dbh->errstr 
         if ($DEBUG) {
-            die "$self couldn't prepare the query '$query_string'"
-                . $self->dbh->errstr . "\n";
+            die "$message\n";
         } else {
-            warn "$self couldn't prepare the query '$query_string'"
-                . $self->dbh->errstr . "\n";
+            warn "$message\n";
             my $ret = Class::ReturnValue->new();
             $ret->as_error(
                 errno   => '-1',
-                message => "Couldn't prepare the query '$query_string'."
-                    . $self->dbh->errstr,
+                message => $message,
                 do_backtrace => undef
             );
             return ( $ret->return_value );


More information about the Jifty-commit mailing list