myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3659] branches/component-api/lib: Improved compo


From: noreply
Subject: [myexperiment-hackers] [3659] branches/component-api/lib: Improved component query error reporting
Date: Mon, 2 Sep 2013 13:33:11 +0000 (UTC)

Revision
3659
Author
fbacall
Date
2013-09-02 13:33:11 +0000 (Mon, 02 Sep 2013)

Log Message

Improved component query error reporting

Modified Paths

Diff

Modified: branches/component-api/lib/rest.rb (3658 => 3659)


--- branches/component-api/lib/rest.rb	2013-09-02 12:18:07 UTC (rev 3658)
+++ branches/component-api/lib/rest.rb	2013-09-02 13:33:11 UTC (rev 3659)
@@ -1276,8 +1276,10 @@
 def rest_call_request(opts)
   begin
     send(opts[:rules]['Function'], opts)
-  rescue
+  rescue Exception => e
     if Rails.env == "production"
+      logger.info e.message
+      logger.info e.backtrace.join("\n")
       return rest_response(500)
     else
       raise

Modified: branches/component-api/lib/sesame.rb (3658 => 3659)


--- branches/component-api/lib/sesame.rb	2013-09-02 12:18:07 UTC (rev 3658)
+++ branches/component-api/lib/sesame.rb	2013-09-02 13:33:11 UTC (rev 3659)
@@ -24,7 +24,11 @@
       request.body = rdf
       request.content_type = content_type
 
-      response = @connection.request url, request   #Net::HTTP::Persistent::Error if can't connect
+      begin
+        response = @connection.request url, request   #Net::HTTP::Persistent::Error if can't connect
+      rescue Net::HTTP::Persistent::Error
+        raise ConnectionException.new, "Couldn't connect to address@hidden"
+      end
 
       case response.code
         when '204'
@@ -40,7 +44,11 @@
       url = ""
       request =  Net::HTTP::Get.new url.request_uri
       request['accept'] = 'application/sparql-results+xml'
-      response = @connection.request url, request
+      begin
+        response = @connection.request url, request
+      rescue Net::HTTP::Persistent::Error
+        raise ConnectionException.new, "Couldn't connect to address@hidden"
+      end
 
       case response.code
         when '200'
@@ -64,7 +72,11 @@
 
       url = ""
       request = Net::HTTP::Delete.new url.request_uri
-      response = @connection.request url, request
+      begin
+        response = @connection.request url, request
+      rescue Net::HTTP::Persistent::Error
+        raise ConnectionException.new, "Couldn't connect to address@hidden"
+      end
 
       case response.code
         when '204'
@@ -76,6 +88,8 @@
 
   end
 
+  class ConnectionException < Exception;  end
+
   class RequestException < Exception
     attr_reader :code
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]