houxq / flash-console

Automatically exported from code.google.com/p/flash-console
0 stars 0 forks source link

Global Error Handling for AIR 2.0 and Flash 10.1 #42

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
To do once its really out in the wild...
http://blogs.adobe.com/cantrell/archives/2009/10/global_error_handling_in_air
_20.html

Original issue reported on code.google.com by luay...@gmail.com on 16 Apr 2010 at 5:20

GoogleCodeExporter commented 8 years ago
public function listenGlobalErrors(loaderinfo:LoaderInfo):void {
    try{
        var uncaughtErrorEvents:IEventDispatcher = loaderinfo["uncaughtErrorEvents"];
        if(uncaughtErrorEvents){
            uncaughtErrorEvents.addEventListener("uncaughtError", uncaughtErrorHandle);
        }
    }catch(err:Error){
        // seems uncaughtErrorEvents is not avaviable on this player, which is fine.
    }
}
private function uncaughtErrorHandle(e:Event):void{
    var error:Object = e["error"]
    if (error is Error){
        C.error(Error(error).message);
    }else if (error is ErrorEvent){
        C.error(ErrorEvent(error).text);
    }else{
        C.error(error.toString());
    }
}

Original comment by luay...@gmail.com on 1 Jul 2010 at 11:27

GoogleCodeExporter commented 8 years ago

Original comment by luay...@gmail.com on 10 Jul 2010 at 3:38