Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved product URL error message to show which URLs were not unique #75

Merged
merged 2 commits into from
Dec 14, 2022

Conversation

erfanimani
Copy link
Contributor

If the exception is of type \Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException, we can actually get the list of URL rewrites that failed by calling its getUrls method.

I needed this for a project where I couldn't use the baldwin module because it doesn't show URL clashes between 301/302 URLs, product URLs and category URLs (I believe that it can only show duplicate URLs of a single entity type).

To be honest, the next catch clause can probably be dropped entirely. (I don't mind the initial exception being caught/processed by Symfony command.)

Also, it needs to be clear that even one error will cause the entire batch of ~500 URLs to be rolled back and fail. Maybe I could add that to the error msg?

@peterjaap peterjaap merged commit 5911c9f into elgentos:master Dec 14, 2022
@peterjaap
Copy link
Collaborator

Well whatthediff.ai wasn't any help with that :D So I added it manually.

Thanks!!

@erfanimani
Copy link
Contributor Author

Awesome, thanks for the quick merge!

@erfanimani erfanimani deleted the improve-error-message branch December 22, 2022 03:34
@elgentos elgentos deleted a comment from what-the-diff bot Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants