-
Notifications
You must be signed in to change notification settings - Fork 28
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
Errors #20
Comments
Right now this isn't handled by YAYSON. It would be great to get it in there though! If you would like to write a pull request that would be much appriciated :) |
Yes, there are then many options to consider, http response codes are involved here, so you need at least response object, which then can handle these, YAYSON doesn't even bother with content types as a quick browse through the code, but specification is quite explicit about it. But the most easy variant would be to "add errors", and then render would see if there are errors, then render error instead of the data, depends how deep you want to integrate it as a generic solution, or just as a quick serialisation to the user. |
Yeah, so YAYSON is built so you can transport your data as you wish. So we use it over websockets for instance. Maybe some kind of error presenter is the way to go? |
How would you like to use an ErrorPresenter? Ive been thinking about adding one. Here is the full spec: http://jsonapi.org/format/#errors I guess it makes sense that you inherit from the ErrorPresenter and there you specify the bout link for instance? And I guess the rest is just common attributes? |
For my use case, I ended up checking if the response is an error when I receive it. If it is an error I return the error, if it isn't an error, I run it through YAYSON.
|
How do you render/trigger errors, when they happen? This is also in JSON API 1.0 specification.
The text was updated successfully, but these errors were encountered: