You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/11/26 11:53:21 UTC

svn commit: r479338 - /incubator/tuscany/cpp/sca/samples/RubyBigBank/bigbank.account/StockQuoteServiceImpl.rb

Author: jsdelfino
Date: Sun Nov 26 02:53:20 2006
New Revision: 479338

URL: http://svn.apache.org/viewvc?view=rev&rev=479338
Log:
Added rescue block to StockQuoteService to handle network errors

Modified:
    incubator/tuscany/cpp/sca/samples/RubyBigBank/bigbank.account/StockQuoteServiceImpl.rb

Modified: incubator/tuscany/cpp/sca/samples/RubyBigBank/bigbank.account/StockQuoteServiceImpl.rb
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/samples/RubyBigBank/bigbank.account/StockQuoteServiceImpl.rb?view=diff&rev=479338&r1=479337&r2=479338
==============================================================================
--- incubator/tuscany/cpp/sca/samples/RubyBigBank/bigbank.account/StockQuoteServiceImpl.rb (original)
+++ incubator/tuscany/cpp/sca/samples/RubyBigBank/bigbank.account/StockQuoteServiceImpl.rb Sun Nov 26 02:53:20 2006
@@ -29,11 +29,20 @@
 
   def getQuote(symbol)
     print "Ruby - StockQuoteServiceImpl.getQuote ", symbol, "\n"
-    
-    result = @webService.GetQuote(symbol)
-    doc = Document.new(result)
-    
-    price = doc.root.elements["Stock"].elements["Last"].text;
+
+    price = 0
+    catch (:RuntimeError) do
+      begin
+      
+        result = @webService.GetQuote(symbol)
+        doc = Document.new(result)
+        price = doc.root.elements["Stock"].elements["Last"].text;
+        
+      rescue
+        # offline or StockQuote web service is down
+        price = 95.0
+      end
+    end  
     
     print "Ruby - stock price = ", price, "\n"
     



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org