afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-08-01 03:23 pm

[dw-free] Misleading error message when the userproplist table contains no rows

[commit: http://hg.dwscoalition.org/dw-free/rev/00e461c755de]

http://bugs.dwscoalition.org/show_bug.cgi?id=1478

Clearer error message.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/ljlib.pl
--------------------------------------------------------------------------------
diff -r 8358fd405298 -r 00e461c755de cgi-bin/ljlib.pl
--- a/cgi-bin/ljlib.pl	Sat Aug 01 15:19:06 2009 +0000
+++ b/cgi-bin/ljlib.pl	Sat Aug 01 15:23:20 2009 +0000
@@ -737,6 +737,8 @@ sub load_props
         $dbr ||= LJ::get_db_reader();
         my $sth = $dbr->prepare("SELECT * FROM $tablename");
         $sth->execute;
+        # check error in case table does not exist
+        warn "Error loading $tablename: $sth->errstr" and next if $sth->err;
         while (my $p = $sth->fetchrow_hashref) {
             $p->{'id'} = $p->{$keyname{$t}};
             $LJ::CACHE_PROP{$t}->{$p->{'name'}} = $p;
@@ -768,7 +770,7 @@ sub get_prop
     }
 
     unless ($LJ::CACHE_PROP{$table}) {
-        warn "Prop table does not exist: $table" if $LJ::IS_DEV_SERVER;
+        warn "Prop table has no data: $table" if $LJ::IS_DEV_SERVER;
         return undef;
     }
 
--------------------------------------------------------------------------------