Explorar el Código

Add tripal_report_error

Abdullah Almsaeed hace 6 años
padre
commit
063ec59dab

+ 3 - 0
tripal_ws/includes/TripalFields/remote__data/remote__data.inc

@@ -239,6 +239,7 @@ class remote__data extends WebServicesField {
     }
 
     if(empty($remote_site)) {
+      tripal_report_error('tripal_ws', TRIPAL_ERROR, 'Unable to find remote_site in remote__data field while attempting to build the remote URL.');
       return null;
     }
 
@@ -260,12 +261,14 @@ class remote__data extends WebServicesField {
      }
 
     if(empty($this->remote_site)) {
+      tripal_report_error('tripal_ws', TRIPAL_ERROR, 'Unable to find remote_site while attempting to make the request.');
       return null;
     }
 
      try {
        $data = tripal_get_remote_content($this->remote_site->id, $path, $q);
      } catch (Exception $exception) {
+      tripal_report_error('tripal_ws', TRIPAL_ERROR, $exception->getMessage());
        return null;
      }
 

+ 4 - 0
tripal_ws/includes/TripalFields/remote__data/remote__data_formatter.inc

@@ -148,6 +148,10 @@ class remote__data_formatter extends WebServicesFieldFormatter {
             ['attributes' => ["target" => '_blank']])
         ]);
     }
+    else  {
+      tripal_report_error('tripal_ws', TRIPAL_ERROR, 'Unable to find remote site while attempting to format results.');
+    }
+
     if (is_object($site_logo)) {
       $content .= '<img class="tripal-remote--data-field-logo" src="' . file_create_url($site_logo->uri) . '"><br/>';
     }