Issue Type: Improvement Created: 2008-12-01T03:19:37.000+0000 Last Updated: 2011-07-08T20:43:12.000+0000 Status: Open Fix version(s): Reporter: Maurice Fonk (naneau) Assignee: Wade Arnold (wadearnold) Tags: - Zend_Amf
Related issues: Attachments: - 005-Zend_Amf_Server.patch
When an exception is thrown inside a service class, Zend_Amf will catch it, but it will not return a "proper" AMF response to the client. This really gets in the way of properly debugging the service. After an exception is thrown, the output changes to: "
Zend Amf Endpoint
" which can not be parsed by a client expecting an AMF response.
It's not possible to make Zend_Amf not catch exceptions, so it's hard to get around this.
Posted by old of Satoru Yoshida (email@example.com) on 2008-12-02T05:50:28.000+0000
set component name and auto assign again
Posted by Maurice Fonk (naneau) on 2008-12-04T04:44:04.000+0000
I suppose what I'm trying to say is, it would be an extremely welcome addition to Zend_Amf if it had some kind of "debug" mode, where it has ways of recording php errors/thrown exceptions. Right now it pushed an (empty!) errormessage to the client, which makes it impossible to debug on that end. You can't put a try/catch block around the server code either, because it catches any exceptions internally.
Posted by Wade Arnold (wadearnold) on 2008-12-04T08:22:09.000+0000
I agree thanks for your advice. I will add it into the next minor release. Please continue giving workflow feedback like this!
Posted by Jurrien Stutterheim (norm2782) on 2009-01-09T07:15:39.000+0000
This is already resolved by the setProduction(false) trick, right?
Posted by Wade Arnold (wadearnold) on 2009-01-09T07:20:20.000+0000
Yes you get the detailed php error message through setProduction(false). Otherwise you will just receive the error code.
Posted by Maurice Fonk (naneau) on 2009-01-09T07:22:51.000+0000
Can you confirm it doesn't give back "
Zend Amf Endpoint
" as the body even with setProduction(true) ? Because that results in errors on the flex side
Posted by Wade Arnold (wadearnold) on 2009-01-09T07:27:00.000+0000
I will write an example to confirm and add it to the documentation.
Posted by Nikita Y Volkov (mojojojo) on 2009-04-23T11:12:15.000+0000
SetProduction(false) trick is nice but no need to explain that you can't apply it in production environment. So an evident question appears: how do you track errors on production environment? I found the answer to be "you can't".
I bet a lot of developers would love to have ability to log errors in this case. So maybe consider something similar to Zend MVC's ErrorController solution?
Posted by Wade Arnold (wadearnold) on 2009-04-23T11:53:56.000+0000
I will check out how they implemented it.
Posted by Maurice Fonk (naneau) on 2009-04-29T04:56:52.000+0000
It would be nice to at least have the option to set a callback that will get called when an exception is caught by the AMF server. That and a proper set_error_handler() would be enough to log problems to disk. The option to be able to log the response before it is encoded to disk is also nice. To debug this sort of thing now I have to "fake" a request using my browser and log the response there.
Posted by Gordon Potter (gordon) on 2009-04-29T21:26:46.000+0000
Anything that could be added to the documentation around proper debugging techniques and solutions would be very welcome. I find trying to resolve what when wrong on the PHP side from within Flex a little more painful than it should be. To make matters worse there seem to be specific scenarios where Zend AMF fails, no errors arise in the PHP server logs, and the Flex client just barfs up its Delivery in Doubt messages. These silent errors are very aggravating when trying to resolve a bug on a deadline.
In traditional PHP+HTML development the browser tells you right away if something is wrong on the server. Inside flex the errors don't come trough as transparently.
Posted by Nikita Y Volkov (mojojojo) on 2009-04-30T03:52:20.000+0000
Totally agree with Gordon.
As a possible solution I propose to surround the execution of operation block inside Zend_Amf with try-catch and thus accumulate exceptions, than throw them when it comes to Zend_Amf_Server::handle() calling. The behaviour of this could be controlled by some additional settings to Zend_Amf.
Posted by Stefan Klug (stefanklug) on 2009-05-20T02:51:47.000+0000
As I needed the discussed functionality and to get this issue rolling I propose the attached modification to the Server.
Posted by Michał Gańko (mganko) on 2011-07-08T20:43:12.000+0000
Some time ago I created ExtraLoggingZendAmfServer class. It has one additional method setExceptionHandler which gets class name or instance of class and the name of the method in this class to execute when exception happens. See here: [http://flexphperia.net/en/php-with-flex/…]
Have you found an issue?
See the Overview section for more details.