-
-
Notifications
You must be signed in to change notification settings - Fork 888
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
IRI Converter Exception Messages #2172
Comments
Actually the exception messages here sound exactly correct to me. |
But I think no. 3 should be fixed 😄 |
The problem mentioned in the SO question really is more complicated. I still believe we need to have better support for DTOs / resource representation classes by having a 2-pass process: #2053 |
@teohhanhui I think the issue I personally had with errors 1 and 2, is that the error made no sense in the context of what was going on. I had no idea why a route was even trying to be generated for my Model. It wasn't till i learned that API platform uses the symfony router to generate the IRI, did the error kind of make sense. I think if the error included a clause like |
Sure, I guess we could catch the exception and wrap it. :) |
Hi, my solution to avoid declaring a /edit: whooops wrong issue leaving the comment anyway just in case. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
The default IRI Converter uses the symfony router to handle the generation of the IRI values per entity. If there are any issues with IRI generation or lookup by IRI, the exceptions that get thrown are hard to understand/misleading because the errors will be associated with Routing and not with denormalizing an entity or fetching an entity by an IRI.
Here are a few examples of some scenarios that generate errors with the IRI Converter and have confusing error messages:
You can get errors 1 and 2 if API Platform tries to serialize an entity that does not have a GET item/collection operation defined which is common when working with DTO's. See this Stackoverflow Post
Error 3 can show up if you pass in malformed IRI value for a relationship entity.
I think a possible solution for friendlier error messages would be to catch exceptions thrown in the in the normalizers and give error messages that are closer to the actual problem.
The text was updated successfully, but these errors were encountered: