Building extensions - debugging

Sitemagic CMS is using two techniques to ensure proper and reliable execution of extensions.


Logging

When an error occures in Sitemagic CMS, the error is immediately logged to the SMLog data source. PHP errors are therefore never outputted to the screen. During development of new extensions, it is important to keep an eye on the SMLog data source, to ensure that errors are not registered.


Exceptions

Functions within the framework uses exceptions to indicate errors. Usually exceptions can be avoided if function input is validated properly. If this is not possible, try-catching may be used, to catch exceptions, to allow execution to proceed.

Exceptions are displayed with a message and a complete stack trace, allowing the developer to track down errors in a matter of minutes.