Expand my Community achievements bar.

Fault during getItem call does not invoke IResponder.fault()

Avatar

Level 1
I'm fetching an item from a DataService:



// Set the keys of wip

// ...

var token:AsyncToken = _dsWip.getItem(wip);

token.addResponder(new DataResponder(

function (event:ResultEvent): void { // result handler

trace("responder result:", event);

// handle result

},

function (info:Object):void { // fault handler

trace("responder fault:", info);

// handle fault

}));



DataResponder implements mx.rpc.IResponder.



If the server is able to fetch the item, everything is
working as expected - the IResponder.result function is called.



However, if an error occurs on the server, the
IResponder.fault function is never called.

Data services generates a FaultEvent - I know that because I
have registered fault event listeners with other instances in the
application. For example, I see this in the trace:

faultHandler - event: [FaultEvent fault=[RPC Fault
faultString="Unable to invoke a get operation on destination 'wip'
due to the following error: ..." faultCode="Server.Processing"
faultDetail="null"]
messageId="1CD8DCBC-1908-DDFA-6961-6748CBB85255" type="fault"
bubbles=false cancelable=true eventPhase=2]



So, there is a fault event as expected, but why is the
IResponder.fault function ignored?

--

Jürgen Failenschmid

2 Replies

Avatar

Former Community Member
BTW, the responder's fault function also is not called for a
fill operation.



As a workaround, I have to register a listener with the data
service

instance for type FaultEvent.FAULT and in the handler
function call the

fault function of any responders like this:



if (event.token.hasResponder()) {

for each (var responder:IResponder in
event.token.responders) {

if (responder.fault is Function) {

trace("dsWipFaultHandler -", "calling fault of responder:",
responder);

responder.fault(event);

}

}

}



It works, but I expected the Data Service to call
IResponder.fault.



--

J�rgen Failenschmid





Avatar

Level 2
I've run into this exact same problem. Has anyone else
figured out what the problem is?