Developers/Concepts/Tine 2.0 Exceptions

From Tine 2.0 - Wiki

< Developers

Tinebase Exceptions overview

Here you will find our concept for exception-handling and the exception types we are using in Tine 2.0.

Each application defines its own exceptions. It could be like that:

 Addressbook/Exception.php (the main application exception Addressbook_Exception)
 Addressbook/Exception/AccessDenied.php (Addressbook_Exception_AccessDenied extends Addressbook_Exception)
 Addressbook/Exception/NotFound.php (Addressbook_Exception_NotFound extends Addressbook_Exception)

Exception Types

_some examples could be added for the following exception types_


The current user doesn't have the needed right or grant to execute the requested function.

Example (from Addressbook_Controller_Contact):

           if (!$this->_currentAccount->hasGrant($contact->container_id, Tinebase_Model_Container::GRANT_READ)) {
               throw new Addressbook_Exception_AccessDenied('Read access to contact denied.');


Some problem with the Backend (database/LDAP error, ...)


One or more of the function arguments didn't meet the requirements (for example $id=0).


Some object/record/... could not be found in the storage.


An unexpected value has appeared somewhere in the code.