[DDC-1822] Intermediary parent for NoResult and NonUnique Exceptions Created: 16/May/12  Updated: 20/May/12  Resolved: 20/May/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: None
Fix Version/s: 2.3
Security Level: All

Type: Improvement Priority: Major
Reporter: Rafael Dohms Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: None


I would like to propose a intermediary parent for the NoResult and NonUnique Exceptions, that is not as high level as ORMEXception, something in between.

The reasoning for this is that sometime si want to get a single object out of the DB, and in case its not there i want to just get a null and carry on. For this I usually need to catch both exceptions as both results might trigger me to do something else, like abort. In some cases i do need to treat each of these in its own way, but in some cases it does not matter to which side the error went, it only matters that its not the expected SingleResult. Catching a ORMException is not adequate as it may include other error which would need to be treated differently.

My proposal would be like:

ORMException -> NotExpectedResultException ->

{NoResult, NonUnique}

Just a more detailed grouping of exceptions. Does this sound like something possible, or am I just nuts?

Comment by Guilherme Blanco [ 20/May/12 ]

Fixed in https://github.com/doctrine/doctrine2/commit/3d8e46447a4fa8871bd268e8ad69820c636e0dea

Generated at Mon Nov 30 10:20:48 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.