[Yt-svn] commit/yt: MatthewTurk: Exceptions will no longer get swallowed by the server.

Bitbucket commits-noreply at bitbucket.org
Sat Apr 23 05:33:33 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/5c9113fce7a1/
changeset:   r4193:5c9113fce7a1
branch:      yt
user:        MatthewTurk
date:        2011-04-23 14:33:24
summary:     Exceptions will no longer get swallowed by the server.
affected #:  3 files (590 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Fri Apr 22 23:21:08 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sat Apr 23 08:33:24 2011 -0400
@@ -34,6 +34,7 @@
 import urllib
 import urllib2
 import pprint
+import traceback
 
 from yt.funcs import *
 from yt.utilities.logger import ytLogger, ufstring
@@ -140,6 +141,12 @@
         self.last_heartbeat = time.time()
         self._check_heartbeat()
 
+    def exception_handler(self, exc):
+        result = {'type': 'cell_results',
+                  'input': 'ERROR HANDLING IN REASON',
+                  'output': traceback.format_exc()}
+        return result
+
     def _setup_logging_handlers(self):
         handler = PayloadLoggingHandler()
         formatter = logging.Formatter(ufstring)


--- a/yt/gui/reason/extdirect_router.py	Fri Apr 22 23:21:08 2011 -0400
+++ b/yt/gui/reason/extdirect_router.py	Sat Apr 23 08:33:24 2011 -0400
@@ -40,6 +40,7 @@
 
     Call an instance of this class with the JSON from an Ext.Direct request.
     """
+    exception_handler = None
     def __call__(self, body):
         """
         """
@@ -98,7 +99,13 @@
         self._data = data
 
         # Finally, call the target method, passing in the data
-        result = _targetfn(**data)
+        try:
+            result = _targetfn(**data)
+        except Exception as e:
+            if self.exception_handler is not None:
+                result = self.exception_handler(e)
+            else:
+                raise e
 
         return {
             'type':'rpc',


--- a/yt/gui/reason/html/js/reason.js	Fri Apr 22 23:21:08 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Sat Apr 23 08:33:24 2011 -0400
@@ -42,6 +42,11 @@
 var cell_count = 0;
 
 var handle_result = function(f, a) {
+    if(a.status == false){
+        Ext.Msg.alert("Error", "Something has gone wrong.");
+        examine = {f: f, a: a};
+        return;
+    }
     cell_finished(a.result);
 }

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list