Browse Source

Small tweak to printed error reporting

Lacey Sanderson 11 years ago
parent
commit
7c1217fedd
1 changed files with 9 additions and 3 deletions
  1. 9 3
      tripal_core/api/tripal_core_chado.api.inc

+ 9 - 3
tripal_core/api/tripal_core_chado.api.inc

@@ -67,7 +67,7 @@ function tripal_core_report_error($type, $severity, $message, $variables = array
     watchdog($type, $message, $variables, $severity);
   }
   catch (Exception $e) {
-    print "CRITICAL -TRIPAL_CORE: Unable to register error message with watchdog";
+    print "CRITICAL (TRIPAL_CORE): Unable to register error message with watchdog";
     $options['print'] = TRUE;
   }
 
@@ -76,7 +76,7 @@ function tripal_core_report_error($type, $severity, $message, $variables = array
     if (sizeof($variables) > 0) {
       $message = str_replace(array_keys($variables), $variables, $message);
     }
-    print $severity_string . ' -' . $type . ':' . $message . "\n";
+    print $severity_string . ' (' . strtoupper($type) . '):' . $message . "\n";
   }
 }
 
@@ -2141,8 +2141,14 @@ function chado_query($sql, $args = array()) {
 
   $is_local = tripal_core_is_chado_local();
 
+  // Args should be an array
   if (!is_array($args)) {
-    watchdog('tripal_core', 'Need to pass an array to chado_query, "%value" passed instead. Query: %query', array('%value' => $args, '%query' => $sql), WATCHDOG_ERROR);
+    tripal_core_report_error(
+      'tripal_core',
+      TRIPAL_ERROR,
+      'chado_query; Need to pass an array to chado_query, "%value" passed instead. Query: %query',
+      array('%value' => $args, '%query' => $sql)
+    );
     $args = array($args);
   }