How to view exceptions parameters in standard flash player? - actionscript-3

Flash exceptions can provide: code,stacktrace, message and parameters.
I.e. ( from Here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/runtimeErrors.html)
#2121 Security sandbox violation: %1: %2 cannot access %3. This may be worked around by calling Security.allowDomain.
In standard flash player (Not debug) normally i see just error code.
I can configure: -compiler.verbose-stacktraces=true to see the stacktrace.
Can I somehow get the arguments as well?
(%1, %2, %3)

Property "message" of the Error object will return a text description of the error. The only way to read parameters is to parse a text description.

Related

Access violation, NotEnemy is 0xBF800000

I use cocos2d-x to do the game. After running my program for a while, the variable "NotEnemy" will always report the "access violation" error. NotEnemy is the variable I set in EventListenerPhysicsContact, always using cocos2d-x There will be errors like the title, all I want to know when there is such a mistake, is there any solution, I hope someone can tell me, right, NotEnemy I am assigned this way, auto NotEnemy=contact.getShapeB( )->getBody()->getNode();
I tried setting it to nullptr after using NotEnemy, but it didn't work. Now it generates a new error "Exception at 0x76EE35D2 (located in TankBattle.exe): Microsoft C++ Exception: std::exception, in memory Location 0x00C5F548.
There is an unhandled exception at 0x7640E6EB (ucrtbase.dll) (in TankBattle.exe): A critical program exit has been requested. ", used to be an error about access permissions conflicts, but they are all problems with NotEnemy, and they all appear in the "NotEnemy->SetPosition(Vec2(166,14))" statement.

How to get information on TypeError coming from a library?

My flex project uses a small swc library. It runs under Flash Builder.
While running the application in debug mode I can see plenty of "TypeError: Error #1009: Cannot access a property or method of a null object reference." displayed in console.
But I have no extra information: which method or property caused the error, on which type, where, etc.
My flex app has an uncaught error mechanism, but no error is caught.
I tried to set compiler option "-debug" to true but no change occurred, logs are not more verbose.
I got the library sources and looked for an Error handling where this log would be written, but I found nothing.
Somebody already encountered such issue?

AS3, Flash: Accessing error messages text in code

I'm working on some flash app. Now, to test customer side of it I can use Flash Player debugger version that will save logs and show error messages. When it's deployed on the customer side - they will have a regular Flash Player version which means I will have no access to error messages if errors will happen. So I would like to equip it with some tool that would capture all of my trace messages in code and errors text. As for trace messages that's fairly simple, I just override the function in my code so it sends a POST request with trace message to a logger server, but how can I get a hold of the error message? Is there a known approach to this or some trick that somebody can suggest?
You can install the debug version of flash as your browser's default (in Chrome, you must disable the built-in player), so if you wanted to test user experience and debug, this would be the ideal solution.
However, to answer your question: there's no method for universally catching all errors, and redirecting them (that I know of). You'd have to encapsulate problem code ahead of time with try...catch statements, and send the property back on catch. For example:
try {
this["foo"]();
} catch (e:Error) {
trace(e);
}
In the debug version, the traced value would be TypeError: Error #1006: value is not a function. And while the standard version will only output TypeError: Error #1006, (a notably less descriptive error), what we're missing is any reference to where the error occured. To get this, we need to use Error.getStackTrace() to see the call stack and the line where the error occurred. In debug, this outputs the following:
TypeError: Error #1006: value is not a function.
at Shell_fla::MainTimeline/init()[C:\Projects\shell.as:91
In the standard client, we get a dissapointing null. In short, you cannot get any valuable info from the client versions.
The best advice I can give is to write around your problem code with your own custom error reports. For example, catch IO errors and trace the file it failed to load, or if you're expecting an object.foo, first try if (object.hasOwnProperty("foo")) { // do something } else { trace("foo not found in " + object.name) }. Code defensively.
Cheers,
I've discovered this post on StackOverflow:
How to catch all exceptions in Flex?
It answers my question, strange that I haven't ran into it while I was googling prior to asking.

libGDX HTML5 deployment exception

I am trying to compile the libGDX project using GWT (libgdx-project-html right click -> Google -> GWT Compile).
I get no errors while compiling except
com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Target
java.lang.StringIndexOutOfBoundsException
but since I'm not using this util should not be a problem.
After the compilation says that it was successful, I ran the local hosted site.
LibGDX logo and loading bar come up (fine until here), and when they are done, I get a black game screen and a box below it with unlimited
GwtApplication: exception: (TypeError) : Cannot call method
'nullMethod' of null (TypeError) : Cannot call method 'nullMethod' of
null
message lines.
In the console the following message is repeated continuously:
Uncaught java.lang.RuntimeException:
com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot
call method 'nullMethod' of null (anonymous function)
597957B2399D3903739C615799AE1A15.cache.html:11899
The project basically is nothing but the logo of libGDX that should come up and fill the game screen (the default one) and no code has been modified.
Some additional notes:
Desktop and Android compile and work flawlessly.
Console says SoundManager 2 loaded (OK) before that error message comes up.
Strict flag is set when GWT compiling and everything are compiled with no errors.
For anyone having the same problem or any other similar/weird exceptions.
Make sure that strict flag is set by adding
-strict
in the compiling arguments and most importantly, you are using
GL20
as WebGL is based on GL20 and doesn't support GL10.

Flash AS3 security errors attempting to load chromeless YouTube

I am getting flash-base security errors when attempting to load a chromeless YouTube swf...
Warning: Domain www.youtube.com does not explicitly specify a meta-policy, but Content-Type of policy file http://www.youtube.com/crossdomain.xml is 'text/x-cross-domain-policy'. Applying meta-policy 'by-content-type'.
Error: Request for resource at http://www.youtube.com/apiplayer?version=3 by requestor from http://... is denied due to lack of policy file permissions.
*** Security Sandbox Violation ***
Connection to http://www.youtube.com/apiplayer?version=3 halted - not permitted from http://...
I've attempted all relevant variations of Security.loadPolicyFile and Security.allowDomain, but I continue to get these errors.
If I ignore these trace errors (I get no callback errors from the Loader) and attempt to use the player (via loader.content during the Loader's Event.INIT), then any attempts to access the YouTube APIs causes a crash.
If I look at my player (Object) variable in a debugger, I see that it is actually a com.goggle.youtube.application::SwfProxy which is derived from Sprite. Outside of the standard Sprite vars and functions, it contains enableJsApi = false, loader = null, and player = "http://s.ytimg.com/yt/swfbin/apiplayer3-vfljSpMoI.swf"
But attempts to call functions such as player.setSize or player.loadVideoByUrl will cause a crash such as...
Exception thrown (TypeError: Error #1006: setSize is not a function.
Please advise.
I have worked with the Chromeless player before and gotten these errors. They are so frustrating. A number of the errors can be ignored because YouTube still hasn't renewed their default policy file.
Whevener you try to add any mouse event listeners to the gadget directly you will get errors that will cripple the runtime process. What I had to do to add mouse interactivity was to add a sprite above the movie clip with a hole where their logo shows up (so that someone can still click their logo) and then add event listeners to your own srite.
Hope this helps.
What finally worked to remove the errors was specifying... LoaderContext(false, new ApplicationDomain())