diff -ur /tmp/civicrm_error/civicrm_error.install ./civicrm_error.install
--- /tmp/civicrm_error/civicrm_error.install	2007-07-21 03:44:34.000000000 +1200
+++ ./civicrm_error.install	2008-10-22 23:01:18.000000000 +1300
@@ -3,10 +3,15 @@
 // $Id: civicrm_error.install,v 1.1 2007/07/20 15:44:34 dalin Exp $
 
 /**
+ * @file
+ * Install file for civicrm_error module
+ */
+
+/**
  * Implementation of hook_install().
  */
 function civicrm_error_install() {
-  civicrm_error_config(true);
+  civicrm_error_config(TRUE);
 }
 
 /**
@@ -17,30 +22,30 @@
   civicrm_error_config(false);
 }
 
-function civicrm_error_config($setup = true) {
+function civicrm_error_config($setup = TRUE) {
   global $db_url;
   if (is_array($db_url) && isset($db_url['civicrm'])) {
     db_set_active('civicrm');
-    $domains = db_result(db_query('SELECT COUNT(id) FROM civicrm_domain'));
+    $domains = db_result(db_query('SELECT COUNT(id) FROM {civicrm_domain}'));
     if ($domains = 1) {
-      $config = unserialize(db_result(db_query('SELECT config_backend FROM civicrm_domain WHERE id = 1')));
+      $config = unserialize(db_result(db_query('SELECT config_backend FROM {civicrm_domain} WHERE id = 1')));
       if (array_key_exists('fatalErrorHandler', $config)) {
-        $config['fatalErrorHandler'] = ($setup ? 'civicrm_error_handler' : null);
+        $config['fatalErrorHandler'] = ($setup ? 'civicrm_error_handler' : NULL);
         /** TODO: this royal screws things up.  Need to fix **/
 //         db_query('UPDATE civicrm_domain SET config_backend = "$s" WHERE id = 1', serialize($config));
-        $fail = true;
+        $fail = TRUE;
       }
       else {
-        $fail = true;
+        $fail = TRUE;
       }
     }
     else {
-      $fail = true;
+      $fail = TRUE;
     }
     db_set_active();
   }
   else {
-    $fail = true;
+    $fail = TRUE;
   }
   if ($fail) {
     $not = !$setup ? 'not ' : '';
diff -ur /tmp/civicrm_error/civicrm_error.module ./civicrm_error.module
--- /tmp/civicrm_error/civicrm_error.module	2008-10-22 22:31:12.000000000 +1300
+++ ./civicrm_error.module	2008-10-22 23:03:40.000000000 +1300
@@ -3,6 +3,11 @@
 // $Id: civicrm_error.module,v 1.1.2.3 2007/07/23 22:03:20 dalin Exp $
 
 /**
+ * @file
+ * Module to capture errors from CiviCRM
+ */
+
+/**
  *  Custom error function
  *  Set CiviCRM » Administer CiviCRM » Global Settings » Debugging » Fatal Error Handler
  *  To use this function
@@ -47,7 +52,7 @@
   $backtrace = debug_backtrace();
   $output .= "\n\n============================== BACKTRACE ==============================\n";
   foreach ($backtrace as $call) {
-    $output .= "\n ------------------------------- Next Call -----------------------------\n\n";
+    $output .= "\n------------------------------- Next Call -----------------------------\n\n";
     $output .= _civicrm_error_parse_array($call);
   }
 
@@ -55,14 +60,16 @@
   $subject = 'CiviCRM error at '. $site;
   $to = variable_get('civicrm_error_to', variable_get("site_mail", ini_get("sendmail_from")));
   $errors_via = variable_get('civicrm_error_via', 'both') ;
-  switch( $errors_via ) {
+  switch ( $errors_via ) {
   case "watchdog":  
-    watchdog('civicrm error', '<pre>' . $output . '</pre>' ) ;
+    watchdog('civicrm error', '<pre>'. $output .'</pre>') ;
     break ;
   case "both":
-    watchdog('civicrm error', '<pre>' . $output . '</pre>' ) ;  
+    watchdog('civicrm error', '<pre>'. $output .'</pre>') ;
+    // continue to "email" case here.
   case "email":
     drupal_mail('civicrm_error', $to, $subject, $output);
+    break ;
   }
 }
 
@@ -70,9 +77,9 @@
  *  Helper function to return a pretty print of the given array
  */
 function _civicrm_error_parse_array($array) {
-  foreach((array)$array as $key => $value) {
+  foreach ((array)$array as $key => $value) {
     if (is_array($value) || is_object($value)) {
-      $value = print_r($value, true);
+      $value = print_r($value, TRUE);
     }
     $key = str_pad($key .':', 20, ' ');
     $output .= "\n" . $key . (string)_civicrm_error_check_length($value) ;
@@ -126,9 +133,11 @@
   $form['civicrm_error_via'] = array(
     '#type' => 'select',
     '#title' => t('Errors via'),
-    '#options' => array( 'both' => 'Email and Watchdog', 
-                         'watchdog' => 'Watchdog only', 
-                         'email' => 'Email only' ),
+    '#options' => array( 
+      'both'     => 'Email and Watchdog', 
+      'watchdog' => 'Watchdog only', 
+      'email'    => 'Email only',
+    ),
     '#default_value' => variable_get('civicrm_error_via', 'both'),
     '#description' => t("Method for error delivery."),
   );
