Developers/Concepts/Tine 2.0 Exceptions
Contents |
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) Addressbook/Exception/[...]
Exception Types
_some examples could be added for the following exception types_
AccessDenied
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.');
}
Backend
Some problem with the Backend (database/LDAP error, ...)
InvalidArgument
One or more of the function arguments didn't meet the requirements (for example $id=0).
NotFound
Some object/record/... could not be found in the storage.
UnexpectedValue
An unexpected value has appeared somewhere in the code.



