-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add SKU or ID to NoSuchEntityException in ProductRepository #40096
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
base: 2.4-develop
Are you sure you want to change the base?
Add SKU or ID to NoSuchEntityException in ProductRepository #40096
Conversation
Hi @mimou78. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
@magento run WebAPI Tests Static Tests |
Failed to run the builds. Please try to re-run them later. |
@magento run WebAPI Tests Static Tests |
Failed to run the builds. Please try to re-run them later. |
@magento run WebAPI Tests Static Tests |
Failed to run the builds. Please try to re-run them later. |
@magento run WebAPI Tests |
Description (*)
This PR improves the exception messages in
Magento\Catalog\Model\ProductRepository::get()
andgetById()
methods when a product is not found. The current message lacks context, which makes debugging harder.Now the error message includes the SKU or ID used in the lookup.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
GET /V1/products/unknown-sku
via REST or use$productRepository->get('unknown-sku')
The product that was requested doesn't exist.
The product with SKU "unknown-sku" does not exist.
$productRepository->getById(999999)
The product that was requested doesn't exist.
The product with ID "999999" does not exist.
Questions or comments
Contribution checklist (*)