[DCOM-105] Common base exception class Created: 27/Aug/12  Updated: 21/Feb/13  Resolved: 21/Feb/13

Status: Closed
Project: Doctrine Common
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Till Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None


 Description   

Per our discussion on IRC/Twitter.

It would be nice if all exceptions thrown had a common base, so something like this is possible to catch all exceptions from Doctrine:

try {
    // some code here
} catch (\Doctrine\Common\BaseException $e) {
    // something in Doctrine threw an exception, handle it here
}

(The name is just an example.)

For reference:
https://wiki.php.net/pear/rfc/pear2_exception_policy



 Comments   
Comment by Christophe Coevoet [ 27/Aug/12 ]

Instead of a base class (which forbids extending the SPL exception), I would go the same way than Symfony2 and ZF: using an interface.

Comment by Till [ 27/Aug/12 ]

That's basically what the PEAR2 RFC is doing.

Comment by Marco Pivetta [ 21/Feb/13 ]

Duplicate of DCOM-80

Generated at Sun Oct 26 03:04:33 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.