I'm looking for a way to catch an Exception thrown by PHP in Flex using HTTPService
. Is it possible to do it without using AMFPHP?
In my current implementation, if an Exception is thrown in PHP, a FaultEvent.FAULT
is indeed dispatched on Flex side. The only problem is that the exception's message string is nowhere to be found in FaultEvent
.
Let me try to explain better with the help of an example. Let us say we have the following PHP code on server side:
<?php
throw new Exception("Exception message");
?>
On flex side, say there is an HTTPService
instance which calls the above PHP code. Moreover, it calls the following function on FaultEvent.FAULT
:
private function onFaultyResult(evt:FaultEvent):void {
//How do I get the exception message here?
}
How can I get the exception message from PHP in this function?
Note: trace(evt.toString())
gives:
[FaultEvent fault=[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: 192.168.1.119/exception.php"]. URL: 192.168.1.119/exception.php"] messageId="7FF021A3-8C83-CB14-081D-8C8438802204" type="fault" bubbles=false cancelable=true eventPhase=2]
I also looked for "Exception message" in other fields of evt
in the debugger but couldn't find it.
Thank you