On Thu, Feb 14, 2008 at 3:02 PM, Gaetan de Menten <[EMAIL PROTECTED]> wrote:
>
> On Wed, Feb 13, 2008 at 9:53 AM, Fabian Jakobs <[EMAIL PROTECTED]> wrote:
>  >  >
>  >  > I've been having the following problem for quite a while: whenever I
>  >  > throw an exception in a code which is executed in a callback of a
>  >  > request, nothing noticeable happens, except the request just timeouts
>  >  > (ie the initial exception is not printed in the (Firebug) console).
>  >  >
>  >  > var req = new qx.io.remote.Request("/");
>  >  > req.setProhibitCaching(false);
>  >  > req.addEventListener("completed", function(e) {
>  >  >         throw new Error("test");
>  >  > }, this);
>  >  > req.send();
>  >  >
>  >  > I've just found a workaround, which is to enclose the callback code
>  >  > into a try catch block and use this.error, as in:
>  >  >
>  >  > var req = new qx.io.remote.Request("/");
>  >  > req.addEventListener("completed", function(e) {
>  >  >     try {
>  >  >         throw new Error("test");
>  >  >     } catch (error) {
>  >  >         this.error('Error in IO request', error);
>  >  >     }
>  >  > }, this);
>  >  > req.send();
>  >  >
>  >  > This seems to work fine but produces longer than necessary tracebacks
>  >  > and also require me to modify all my callbacks. I'd like a global fix
>  >  > or workaround. This might not be a Qooxdoo bug (I suspect it's rather
>  >  > a firebug bug or missing feature),  but nevertheless, has anybody
>  >  > found a solution or another nicer workaround to this?
>  >  >
>  >  I suspect the problem are these lines of code in qx.io.remote.Exchange:900
>  >
>  >             try{
>  >               this.dispatchEvent(vResponse);
>  >             } catch(ex) {
>  >               this.error("Dispatch failed", ex);
>  >             }
>  >
>  >  The event dispatch is enclosed by a try catch block, which might "eat"
>  >  your exception. What happens if you comment out the "try/catch"
>  >  statement and call dispatchEvent without it?
>  >
>
>  I don't have that try/catch block in my copy (0.7.x branch). Besides,
>  I confirm this is a bug/missing feature in firebug and not in qooxdoo:
>  with firebug disabled, I get the exception in firefox's "error
>  console" as expected.
>
>  I guess I'll use my workaround (unless somebody has a better
>  workaround to suggest) until the problem is fixed in firebug. Thanks
>  all for your answers.

For those who are interested, here is a patch to qooxdoo to workaround
the problem globally.

-- 
Gaƫtan de Menten
http://openhex.org
Index: io/remote/Request.js
===================================================================
--- io/remote/Request.js	(revision 11777)
+++ io/remote/Request.js	(working copy)
@@ -339,6 +339,17 @@
 
   members :
   {
+    addEventListener : function(type, func, obj)
+    {
+      this.base(arguments, type, function(evt) {
+        try {
+          func.call(this, evt);
+        } catch (error) {
+          this.error('Error in IO request', error);
+        }
+      }, obj);
+    },
+    
     /*
     ---------------------------------------------------------------------------
       CORE METHODS
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to