Browse Source

Replaced throwing of Exceptions with tripal_report_error

Stephen Ficklin 6 năm trước cách đây
mục cha
commit
e695b9180b
1 tập tin đã thay đổi với 13 bổ sung5 xóa
  1. 13 5
      tripal_chado/api/tripal_chado.custom_tables.api.inc

+ 13 - 5
tripal_chado/api/tripal_chado.custom_tables.api.inc

@@ -86,8 +86,10 @@ function chado_edit_custom_table($table_id, $table_name, $schema, $skip_if_exist
 }
 
 /**
- * Add a new table to the Chado schema. This function is simply a wrapper for
- * the db_create_table() function of Drupal, but ensures the table is created
+ * Add a new table to the Chado schema. 
+ * 
+ * This function is simply a wrapper for  the db_create_table() function of 
+ * Drupal, but ensures the table is created
  * inside the Chado schema rather than the Drupal schema.  If the table already
  * exists then it will be dropped and recreated using the schema provided.
  * However, it will only drop a table if it exsits in the tripal_custom_tables
@@ -130,13 +132,19 @@ function chado_create_custom_table($table, $schema, $skip_if_exists = TRUE,
     $mview_id = NULL, $redirect = TRUE) {
   
   if (!$table) {
-    throw new Exception('Please provide a value for the $table argument to the chado_create_custom_table() function'); 
+    tripal_report_error('trp_ctables', TRIPAL_ERROR, 
+      'Please provide a value for the $table argument to the chado_create_custom_table() function');
+    return FALSE;
   }
   if (!$schema) {
-    throw new Exception('Please provide a value for the $schema argument to the chado_create_custom_table() function');
+    tripal_report_error('trp_ctables', TRIPAL_ERROR, 
+      'Please provide a value for the $schema argument to the chado_create_custom_table() function');
+    return FALSE;
   }
   if ($schema and !is_array($schema)) {
-    throw new Exception('Please provide an array for the $schema argument to the chado_create_custom_table() function');
+    tripal_report_error('trp_ctables', TRIPAL_ERROR, 
+      'Please provide an array for the $schema argument to the chado_create_custom_table() function');
+    return FALSE;
   }
   // TODO: make sure the schema is valid by adding extra checks.