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

Support for Errors #5

Closed
wardsa013 opened this issue Jan 11, 2017 · 3 comments
Closed

Support for Errors #5

wardsa013 opened this issue Jan 11, 2017 · 3 comments

Comments

@wardsa013
Copy link

Would be great if support for serializing errors (http://jsonapi.org/format/#error-objects) was available.

Unless they are already implemented and I'm overlooking them.

@cosullivan
Copy link
Owner

Hi, no they are not currently supported. I have looked into it in the past and it is on the TODO list. I might revisit this soon.

@wardsa013
Copy link
Author

wardsa013 commented Jan 15, 2017

This is a workaround I ended up writing. Leaving it here in case it could help anybody else until this support gets officially added. Basically all it does is attempt to serialize instances of HttpError prior to running the serialization from this framework.

Gist with source.

You just need to use JsonApiMediaTypeFormatterWithErrorSupport instead of the JsonApiMediaTypeFormatter.

@cosullivan
Copy link
Owner

FYI,

I've just pushed a release that now has support for errors. Would be good to get your feedback.

Thanks,
Cain

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

No branches or pull requests

2 participants