There’s this piece of code I keep on using, I thought I could share it here. The idea is to keep the displaying of error messages separate from their generation.

The error router is a singleton that can be used to separate error generation from error display. Code generating an error can call ErrorRouter.getInstance().notifyError(errorData)
A visual object responsible for displaying error messages can implement IErrorDisplay and call ErrorRouter.getInstance().registerErrorDisplay(this)
If no error display is registered, a simple trace is used.

I’d post the code if posting code in wordpress wasn’t such a pain. You can download it though

http://arielsommeria.com/blog/content/error.zip

Pin It