Added ContentTypeOwnedBySomeoneElseException for content type draft owned by another user#770
Open
bnowak wants to merge 3 commits into
Open
Added ContentTypeOwnedBySomeoneElseException for content type draft owned by another user#770bnowak wants to merge 3 commits into
bnowak wants to merge 3 commits into
Conversation
konradoboza
approved these changes
Jun 29, 2026
tbialcz
approved these changes
Jun 29, 2026
alongosz
reviewed
Jun 29, 2026
konradoboza
approved these changes
Jun 30, 2026
f9c5a30 to
e4a2d8e
Compare
tbialcz
approved these changes
Jul 3, 2026
ciastektk
approved these changes
Jul 3, 2026
alongosz
approved these changes
Jul 3, 2026
alongosz
left a comment
Member
There was a problem hiding this comment.
I'd prefer to see some minimal test coverage for the new exception, but +1.
e4a2d8e to
f330a79
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
ContentTypeService::loadContentTypeDraft()threw a genericNotFoundExceptionwith the message'The content type is owned by someone else'when a draft existed but was owned by a different user,carrying a long-standing
@todo Use another exception when user of draft is someone else.Consumers had no way to distinguish that ownership case from a genuinely missing draft other than by
matching the exception message, which is fragile — the message can change here and silently break
those consumers.
This PR introduces a dedicated
Ibexa\Core\Repository\ContentType\Exception\ContentTypeOwnedBySomeoneElseException(extending
Ibexa\Core\Base\Exceptions\NotFoundException) and throws it fromloadContentTypeDraft(),resolving the
@todo. Callers can now branch on the exception type viainstanceof.The exception passes the same
'The content type is owned by someone else'description to its parent,so the resulting message is unchanged and existing
catch (NotFoundException $e)blocks keep working.Motivation
Raised in review of the MCP
get_content_type_drafttool:https://github.com/ibexa/mcp/pull/14#discussion_r3466283486