Global Error Handling in Flex

Pretty much, one of the most useful things you can have. Any error/exception that gets thrown can get caught in one place. Meaning, no more runtime errors! Simple too.

loaderInfo.uncaughtErrorEvents
.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
private function handleUncaughtError(event:UncaughtErrorEvent):void
{
	event.preventDefault();
	var error:Error = event.error as Error;
	var msg:String = "Uncaught Error: " + error.errorID + ", " + error.name + ", " + error.message;
	trace(msg);
}

Random Papervision Stuff

Added a display object to itself, which caused a stack overflow, pretty sure it’s not the kind that can take over your system though, at least I hope not.  Also tried calling the system garbage collector on enter frame and looks like that drops the framerate by about 4 but keeps memory to a minimum.

Snipplr

Been really busy lately, but this tool has proven to be so useful I had to tell you about it. The site is called snipplr.com which is dedicated to code snippets. You can add existing snippets to your favorites or create your own. The great thing about this is that they have a textmate bundle plugin, which allows you to download snippet into your current code by pressing control, alt, command p, which then searches tags and downloads one of you code snippets directly into your editot.  Also, it allows you to upload to your favorites in realtime, so this might hopefully evolve into a permanent solution for code snippets. Check it out.

Even Better Firebug

 
package
{
	import flash.external.ExternalInterface;
	public function bug(... args):void
	{
		ExternalInterface.call("console.log", args);
	}
}
 

Place that in a file called bug.as and drop it in your classpath, now you have a top level function called bug, that takes as many arguments as you want that even traces out objects and their contents. I’m convinced this is the easiest way to trace from the browser.

Firebug Extended

I recently started using Firebug for outputting, I usually use Monster Debugger, but Firebug turns out to be really impressive and to have some surprising capabilities. I came across this article on Blitz’s blog.  Here is a quick recap:

Can take multiple arguments

console.log(a, b, c);

Has message levels

console.debug(“message”);
console.info(“message”);
console.warn(“message”);
console.error(“message”); Read More…

Next Page » Scroll to top