Interesting rpc error

View: New views
5 Messages — Rating Filter:   Alert me  

Interesting rpc error

by panyasan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

this one is for Derrell and Andreas, the authors of qx.io.remote.Rpc.

in RpcConsole, I am handling an error result from a qx.io.remote.Rpc call
like so:

      this.__failedListener = rpc.addListenerOnce("failed", function(e){
          this.__sendButton.setEnabled(true);
          this.__cancelButton.setEnabled(false);
          var error = e.getData();
          this.handleError( error.toString() );  
          this.cancelRequest();
      },this);

When the PHP service methods crashes with an uncatcheable fatal error, which
produces the following output:

<phpfatalerror>
Fatal error: Call to undefined function adsfadasf() in
/Users/bibliograph/Sites/Bibliograph/RpcPhp/trunk/services/server/ServiceIntrospection.php
on line 167
</phpfatalerror>

The content of the e.getData() -- on FF3.5/Mac -- is typeof = "xml", and
error.toString() produces the following result:
<error>
  <toString>function () {
    switch (obj.origin) {
      case qx.io.remote.Rpc.origin.server:
        return "Server error " + obj.code + ": " + obj.message;
      case qx.io.remote.Rpc.origin.application:
        return "Application error " + obj.code + ": " + obj.message;
      case qx.io.remote.Rpc.origin.transport:
        return "Transport error " + obj.code + ": " + obj.message;
      case qx.io.remote.Rpc.origin.local:
        return "Local error " + obj.code + ": " + obj.message;
      default:
        return "UNEXPECTED origin " + obj.origin + " error " + obj.code + ":
" + obj.message;
    }
}</toString>
</error>

It seems like the object returned to qx.io.remote.Rpc is an XML object,
which gets added a toString() method by the "addToStringToObject()" function
-- however, the original error message is no longer available to the handler
code. Somewhat bizarre to the uninitiated. Any idea how this coudl be
changed?

Thanks,

Christian


--
View this message in context: http://n2.nabble.com/Interesting-rpc-error-tp3928879p3928879.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Re: Interesting rpc error

by Derrell Lipman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Nov 1, 2009 at 18:22, panyasan <info@...> wrote:

Hi,

this one is for Derrell and Andreas, the authors of qx.io.remote.Rpc.

Heh. Don't blame us for that mess! :-)
 

in RpcConsole, I am handling an error result from a qx.io.remote.Rpc call
like so:

     this.__failedListener = rpc.addListenerOnce("failed", function(e){
         this.__sendButton.setEnabled(true);
         this.__cancelButton.setEnabled(false);
         var error = e.getData();
         this.handleError( error.toString() );
         this.cancelRequest();
     },this);

When the PHP service methods crashes with an uncatcheable fatal error, which
produces the following output:

<phpfatalerror>
Fatal error: Call to undefined function adsfadasf() in
/Users/bibliograph/Sites/Bibliograph/RpcPhp/trunk/services/server/ServiceIntrospection.php
on line 167
</phpfatalerror>

PHP doesn't return errors with such a tab as <phpfatalerror> in any version of PHP I've ever used. Since there's a tag, but it's not a valid HTML tag, it must be XML, right? :-) Actually, qx.io.remote.transport.XmlHttp only takes the response to be XML if the response type is application/xml. Do you, or does PHP, ever specify such a thing?
 
The content of the e.getData() -- on FF3.5/Mac -- is typeof = "xml", and
error.toString() produces the following result:
<error>
 <toString>function () {
   switch (obj.origin) {
     case qx.io.remote.Rpc.origin.server:
       return "Server error " + obj.code + ": " + obj.message;
     case qx.io.remote.Rpc.origin.application:
       return "Application error " + obj.code + ": " + obj.message;
     case qx.io.remote.Rpc.origin.transport:
       return "Transport error " + obj.code + ": " + obj.message;
     case qx.io.remote.Rpc.origin.local:
       return "Local error " + obj.code + ": " + obj.message;
     default:
       return "UNEXPECTED origin " + obj.origin + " error " + obj.code + ":
" + obj.message;
   }
}</toString>
</error>

It seems like the object returned to qx.io.remote.Rpc is an XML object,

Yes, but only as described above.
 
which gets added a toString() method by the "addToStringToObject()" function

Yes, but that's much later than deciding if it's XML or not. The toString method isn't added until the repsonse gets all the back up into the Rpc layer.
 
-- however, the original error message is no longer available to the handler
code. Somewhat bizarre to the uninitiated. Any idea how this coudl be
changed?

Likely what needs changing is the fact that the response is XML. Rpc doesn't know anything about XML and will have great trouble dealing with it.

Derrell


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Re: Interesting rpc error

by panyasan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




Derrell Lipman wrote:
>
>
>> Hi,
>>
>> this one is for Derrell and Andreas, the authors of qx.io.remote.Rpc.
>>
>
> Heh. Don't blame us for that mess! :-)
>

No worries. This is just a test. ;-)


Derrell Lipman wrote:

>
>> <phpfatalerror>
>> Fatal error: Call to undefined function adsfadasf() in
>>
>> /Users/bibliograph/Sites/Bibliograph/RpcPhp/trunk/services/server/ServiceIntrospection.php
>> on line 167
>> </phpfatalerror>
>>
>
> PHP doesn't return errors with such a tab as <phpfatalerror> in any
> version
> of PHP I've ever used. Since there's a tag, but it's not a valid HTML tag,
> it must be XML, right? :-) Actually, qx.io.remote.transport.XmlHttp only
> takes the response to be XML if the response type is application/xml. Do
> you, or does PHP, ever specify such a thing?
>

You're right - this is handmade using

   ini_set('error_prepend_string', '<phpfatalerror>');
    ini_set('error_append_string', '</phpfatalerror>');

I am trying to catch fatal errors to avoid messing up the json response.
PHP's fatal errors are almost impossible to catch - the
ini_set('error_prepend_string' ... stuff is the only way I have found that
works. Using "/* ... */" instead worked well in PHP4, but no longer in PHP5.
That's why I tried the XML way and it is an ok workaround but clearly not
ideal. It will issue a  warning ("Received id (undefined) does not match
requested id ") but will no clutter the error console with trancebacks etc.


Derrell Lipman wrote:
>
> Likely what needs changing is the fact that the response is XML. Rpc
> doesn't
> know anything about XML and will have great trouble dealing with it.
>

Ok, I know more. Not much we can do, but it is possible to work with that.

Thanks,

Christian


--
View this message in context: http://n2.nabble.com/Interesting-rpc-error-tp3928879p3929068.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Re: Interesting rpc error

by Derrell Lipman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Nov 1, 2009 at 18:47, Derrell Lipman <derrell.lipman@...> wrote:
On Sun, Nov 1, 2009 at 18:22, panyasan <info@...> wrote:

Hi,

this one is for Derrell and Andreas, the authors of qx.io.remote.Rpc.

Heh. Don't blame us for that mess! :-)

Actually, yes, you were right. That is our code and not too huge a mess at all. As described, though, the problem you describe pertains to what's going on in the layer below RPC, and to the data being sent from the server side.

Derrell


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Re: Interesting rpc error

by panyasan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


See
http://qooxdoo-contrib.svn.sourceforge.net/viewvc/qooxdoo-contrib?view=rev&revision=19479


Derrell Lipman wrote:

>
> On Sun, Nov 1, 2009 at 18:47, Derrell Lipman <
> derrell.lipman@...> wrote:
>
>> On Sun, Nov 1, 2009 at 18:22, panyasan <info@...> wrote:
>>
>>>
>>> Hi,
>>>
>>> this one is for Derrell and Andreas, the authors of qx.io.remote.Rpc.
>>>
>>
>> Heh. Don't blame us for that mess! :-)
>>
>
> Actually, yes, you were right. That is our code and not too huge a mess at
> all. As described, though, the problem you describe pertains to what's
> going
> on in the layer below RPC, and to the data being sent from the server
> side.
>
> Derrell
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@...
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>

--
View this message in context: http://n2.nabble.com/Interesting-rpc-error-tp3928879p3929245.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@...
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel