[mirrorbrain-commits] r8013 - /trunk/mod_mirrorbrain/mod_mirrorbrain.c

From: <poeml_at_mirrorbrain.org>
Date: Fri, 26 Mar 2010 21:25:50 -0000
Author: poeml
Date: Fri Mar 26 22:25:49 2010
New Revision: 8013

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8013&view=rev
Log:
mod_mirrorbrain:
- Database errors from the lower DBD layer are now resolved to strings, where available

Modified:
    trunk/mod_mirrorbrain/mod_mirrorbrain.c

Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.c
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mod_mirrorbrain/mod_mirrorbrain.c?rev=8013&r1=8012&r2=8013&view=diff
==============================================================================
--- trunk/mod_mirrorbrain/mod_mirrorbrain.c (original)
+++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Fri Mar 26 22:25:49 2010
_at_@ -891,13 +891,15 @@
 
     /* we care only about the 1st row, because our query uses 'limit 1' */
     rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, DBD_FIRST_ROW);
-    if (rv != 0) {
+    if (rv != APR_SUCCESS) {
+        const char *errmsg = apr_dbd_error(dbd->driver, dbd->handle, rv);
         ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r,
-                      "[mod_mirrorbrain] Error retrieving row from database for %s "
-                      "(size: %s, mtime %s)",
+                      "[mod_mirrorbrain] Could not retrieve row from database for %s "
+                      "(size: %s, mtime %s): %s",
                       filename,
                       apr_off_t_toa(r->pool, r->finfo.size),
-                      apr_itoa(r->pool, apr_time_sec(r->finfo.mtime)));
+                      apr_itoa(r->pool, apr_time_sec(r->finfo.mtime)),
+                      (errmsg ? errmsg : "[???]"));
         return NULL;
     }
 
_at_@ -990,7 +992,7 @@
     rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, DBD_FIRST_ROW + 1);
     if (rv != -1) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                      "[mod_mirrorbrain] found one row too much looking up hashes for %s",
+                      "[mod_mirrorbrain] found too many rows when looking up hashes for %s",
                       filename);
         return NULL;
     }
_at_@ -1610,9 +1612,11 @@
                              );
 
 
-        if (rv != 0) {
+        if (rv != APR_SUCCESS) {
+            const char *errmsg = apr_dbd_error(dbd->driver, dbd->handle, rv);
             ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-                      "[mod_mirrorbrain] Error looking up %s in database", filename);
+                      "[mod_mirrorbrain] Error looking up %s in database: %s", 
+                      filename, (errmsg ? errmsg : "[???]"));
             return DECLINED;
         }
 




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Fri Mar 26 2010 - 21:25:52 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT