Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.92
diff -u -p -r1.1.2.6.2.92 apachesolr_search.module
--- apachesolr_search.module	14 May 2009 23:10:19 -0000	1.1.2.6.2.92
+++ apachesolr_search.module	4 Jun 2009 13:16:58 -0000
@@ -95,7 +95,7 @@ function apachesolr_search_search($op = 
         return $results;
       }
       catch (Exception $e) {
-        watchdog('Apache Solr', $e->getMessage(), NULL, WATCHDOG_ERROR);
+        watchdog('Apache Solr', check_plain($e->getMessage()), NULL, WATCHDOG_ERROR);
         apachesolr_failure(t('Solr search'), $keys);
       }
       break;
Index: Drupal_Apache_Solr_Service.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/Drupal_Apache_Solr_Service.php,v
retrieving revision 1.1.2.17
diff -u -p -r1.1.2.17 Drupal_Apache_Solr_Service.php
--- Drupal_Apache_Solr_Service.php	30 Apr 2009 18:00:00 -0000	1.1.2.17
+++ Drupal_Apache_Solr_Service.php	4 Jun 2009 13:16:58 -0000
@@ -206,8 +206,14 @@ class Drupal_Apache_Solr_Service extends
   protected function _sendRawGet($url, $timeout = FALSE) {
     list ($data, $headers) = $this->_makeHttpRequest($url, 'GET', array(), '', $timeout);
     $response = new Apache_Solr_Response($data, $headers, $this->_createDocuments, $this->_collapseSingleValueArrays);
-    if ($response->getHttpStatus() != 200) {
-      throw new Exception('"' . $response->getHttpStatus() . '" Status: ' . $response->getHttpStatusMessage());
+    $code = (int) $response->getHttpStatus();
+    if ($code != 200) {
+      $message = $response->getHttpStatusMessage();
+      if ($code >= 400) {
+        // Add details, like Solr's exception message.
+        $message .= $response->getRawResponse();
+      }
+      throw new Exception('"' . $code . '" Status: ' . $message);
     }
     return $response;
   }
@@ -221,8 +227,14 @@ class Drupal_Apache_Solr_Service extends
     $request_headers = array('Content-Type' => $contentType);
     list ($data, $headers) = $this->_makeHttpRequest($url, 'POST', $request_headers, $rawPost, $timeout);
     $response = new Apache_Solr_Response($data, $headers, $this->_createDocuments, $this->_collapseSingleValueArrays);
-    if ($response->getHttpStatus() != 200) {
-      throw new Exception('"' . $response->getHttpStatus() . '" Status: ' . $response->getHttpStatusMessage());
+    $code = (int) $response->getHttpStatus();
+    if ($code != 200) {
+      $message = $response->getHttpStatusMessage();
+      if ($code >= 400) {
+        // Add details, like Solr's exception message.
+        $message .= $response->getRawResponse();
+      }
+      throw new Exception('"' . $code . '" Status: ' . $message);
     }
     return $response;
   }
