0
votes

I obtain this error in my Flex AIR application:

TypeError: Error #1034: Type Coercion failed: cannot convert org.httpclient.events::HttpErrorEvent@daf35f1 to flash.events.IOErrorEvent.
at org.httpclient.events::HttpListener/onInternalError()[/Users/gabe/Projects/as3httpclient/src/org/httpclient/events/HttpListener.as:96]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.httpclient::HttpSocket/onTimeout()[/Users/gabe/Projects/as3httpclient/src/org/httpclient/HttpSocket.as:299]
at org.httpclient::HttpTimer/onTimer()[/Users/gabe/Projects/as3httpclient/src/org/httpclient/HttpTimer.as:50]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

I use the as3httpclient library with a success but after I implemented a code that catches all error events from my application I noticed that this strange error was caught.

There are no references to my own code at all in this stack trace so I can't find the place the error is.

Do you think that this error is a bug in this as3httpclient library?

How can I use this

HttpErrorEvent@daf35f1 

while debugging this error?

One more information: this error appears only once after 1 minute after starting my application.

2
Can you share the code that is causing the error? It sounds like you have an event handler method which has the wrong argument type. - JeffryHouser
I have about 10 handlers and I tried to spot this error just by putting trace("handler1"); at the beginning of each handler so I would know where this error appears but I have no results in my console. I searched in all handlers like these: _socket.addEventListener(IOErrorEvent.IO_ERROR, handler); where each handler has this trace statement mentioned above. - Krzysztof
another example: client.listener.onError = function(event:IOErrorEvent):void { trace("handler2"); ... - Krzysztof
The error occurs trying to call the event handler; so you won't see a trace. Try changing the argument on each handler to Event instead of IOEvent; then slowly add them back one by one until you find the one causing the error. - JeffryHouser
That kind of @reference says ApplicationDomain issue to me. - Amy Blankenship

2 Answers

0
votes

The error occurs trying to call the event handler; so you won't see a trace inside the handler method.

One debug approach is to change the argument on each handler to Event instead of IOEvent. That should remove the errors. Then you can change each method back to IOEvent one by one and re-run the code to determine where the actual error lies.

0
votes

are you using an anonymous function in the handler? this can throw strange errors.

if not, then when you get the error, click through your stack in your debugger to find out what function is handling it.