DDC-1822: Intermediary parent for NoResult and NonUnique Exceptions #2295

Closed
opened 2026-01-22 13:47:36 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (May 16, 2012).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user rdohms:

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?

Originally created by @doctrinebot on GitHub (May 16, 2012). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user rdohms: 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?
admin added the Improvement label 2026-01-22 13:47:36 +01:00
admin closed this issue 2026-01-22 13:47:37 +01:00
Author
Owner

@doctrinebot commented on GitHub (May 20, 2012):

Comment created by @guilhermeblanco:

Fixed in 3d8e46447a

@doctrinebot commented on GitHub (May 20, 2012): Comment created by @guilhermeblanco: Fixed in https://github.com/doctrine/doctrine2/commit/3d8e46447a4fa8871bd268e8ad69820c636e0dea
Author
Owner

@doctrinebot commented on GitHub (May 20, 2012):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (May 20, 2012): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2295