I have the following code that *should* fail :
public class Bar {
public function connect1():void {
trace("t1");
var sock:Socket = new Socket();
sock.addEventListener(IOErrorEvent.IO_ERROR, ioerr_handler);
sock.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
security_handler);
sock.addEventListener(Event.CONNECT, connect_handler);
try {
sock.connect("nonexistent.fubar.bom", 80);
trace("this should not print");
} catch (e:IOError) {
trace("caught error " + e);
} catch (e:SecurityError) {
trace("sec error " + e);
}
trace("t2");
}
private function connect_handler(event:Event):void {
trace("MOJO connect() OK" + event);
}
private function ioerr_handler(event:IOErrorEvent):void {
trace("MOJO IOERROR EVENT OCCURRED " + event);
}
private function security_handler(event:SecurityErrorEvent):void {
trace("MOJO SECERROR EVENT OCCURRED " + event);
}
}
}
When running in a debug flashplayer I am seeing the trace msg "this
should not print" printing to logs. Also neither the IOErrorEvent
handler nor the SecurityErrorEvent handler fire. Also neither the
IOError nor the SecurityExceptionError are being thrown. I am loading
the file off local disk.
Any idea why no error is being thrown ?
-srp