-
Notifications
You must be signed in to change notification settings - Fork 7
Add support for UnsupportedStatementVersionException from php-xapi/exception #37
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
Add support for UnsupportedStatementVersionException from php-xapi/exception #37
Conversation
|
Why this ? It seems logical to me that our serializer implementations throw an exception if they try to deserialize a statement at a version they don't support. This will potentially prevent the Symfony Serializer to throw more obscure exceptions, while this exception make the root of the problem pretty clear. If we make this check after the WDYT @xabbuh ? |
|
Sounds like a good idea to me. But what do you think if we move this exception to the |
|
We will also need to update the changelog. |
|
Why not. It might be useful in the repository part too. |
|
What parent exception should it extend then @xabbuh ? |
|
Do we want it to extend another extension? |
|
Having it extending |
|
One thing that still bothers me: We currently only cover the deserialization part. What if at some point the spec introduces breaking changes which we would need to cover in the model package? From the outside the object might still be a |
|
See php-xapi/exception#1 :) |
This PR was squashed before being merged into the 0.1.x-dev branch (closes #1). Discussion ---------- Add an exception for unsupported statement version Replace php-xapi/serializer#37 Commits ------- e43c0ac Add an exception for unsupported statement version
|
I thought about this once more and I think we should not mix low-level exceptions (like the ones from the serializer package) with high-level exceptions (the exceptions from the exceptions package). Instead, it's the responsibility of an LRS or the client library to map low-level to high-level exceptions. Therefore, I think we should still merge this PR, but with a slightly different exception name (by the way, php-xapi/exception#1 is merged ;)). |
|
I don't see the value of this. In the LrsBundle, we don't map low-level to high-level exceptions but we catch our exceptions - whatever library they are coming from - and throw the good |
|
Good point, I didn't think of some of other other exceptions. Can you then update the exception namespace to use our new one and also add |
|
@xabbuh Done. |
|
Thank you @Lctrs. |
Goal of this exception is to be catched by the
SerializerListenerinphp-xapi/lrs-bundleto throw aBadRequestHttpExceptionwith a specific message.