How to add exceptions support to your SugarCRM projects?

sugarcrmdevelopers —  July 20, 2012

SugarCRMBecause PHP’s Object Oriented support is being improved with each new version, it makes sense to use it’s new features (exceptions included) in your projects, and the ones built on top of SugarCRM should not be different.

Sugar is currently adding exceptions support in their latest developments, though they aren’t used Sugar wide yet, nor have a standard way of implementing exceptions in your projects modules – that’s a start.

In order to work around these limitations, there is Insulin Exception, which allows you to easily create and throw new exceptions, create easily recognizable and unique error codes, to configure multi-language exception messages, add previous exceptions and also has a custom method which creates a pretty-printable log-message string.

In order to start using it, you need to install Insulin Library (follow the installation steps) and read the Insulin Exception documentation on github.

Feel free to get in touch if you need any help or if you want to contribute to the library.