I have created an Zend AMF service using the FlashBuilder tools. What I wanted to try was to change one of those automatically created methods to throw an exception in order to see the behaviour. Instead of the exception being serialized back to my Flex app it gives me the following:
[RPC Fault faultString="Channel disconnected" faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel disconnected before an acknowledgement was received"] at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:345] at mx.rpc::Responder/fault()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:68] at mx.rpc::AsyncRequest/fault()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:113] at NetConnectionMessageResponder/channelDisconnectHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:684] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.messaging::Channel/disconnectSuccess()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messaging\Channel.as:1214] at mx.messaging.channels::NetConnectionChannel/internalDisconnect()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:175] at mx.messaging.channels::AMFChannel/internalDisconnect()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messaging\channels\AMFChannel.as:355] at mx.messaging.channels::AMFChannel/statusHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messaging\channels\AMFChannel.as:445]
The channel disconnects...
[RPC Fault faultString="Channel disconnected" faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel disconnected before an acknowledgement was received"]
This is the code:
public function getAllUser() {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->id, $row->user_group_id, $row->username, $row->password, $row->active, $row->activation_key, $row->timezone, $row->created_on, $row->modified_on);
while (mysqli_stmt_fetch($stmt)) {
$row->created_on = new DateTime($row->created_on);
$row->modified_on = new DateTime($row->modified_on);
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->id, $row->user_group_id, $row->username, $row->password, $row->active, $row->activation_key, $row->timezone, $row->created_on, $row->modified_on);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
$errorCode = 1;
throw(new Exception('the error message you want', $errorCode));
return $rows;
}
Notice the throw statement:
throw(new Exception('the error message you want', $errorCode));
I really didn't expect this. How can I make it work?
Thank you in advanced!!!