-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error response behaviour change in the JSON formatter #1309
Comments
Forgot to tag the original PR. #889 |
cc @dblock @sunnyrjuneja :) |
I believe the behavior is intentional, we want to pass through things as much as possible. This is internal, but I'd be OK to document it in UPGRADING, please PR. |
@dblock Hi, thanks for the prompt response again. Interestingly, after the newly released v To recap and summarise the different behaviours: Original (circa
Changed (circa
New (
So the funny side is that after v |
Yes, you're right @fredwu. Help us get to the bottom of it. |
With the change in #1037 now if you pass in
It wraps the resulting message formatted with Entities::Errors with error: { result of Entity Model }. This is because the if statement is looking at .is_a(Hash) and apparently (unverified) the response from present method being compared to is_a(Hash) is not in fact a Hash, but most likely some Grape::Entity class. |
What do we want to do with this? @fredwu? |
Hi,
As I noted in this commit, there are some behavioural changes that are not very obvious and perhaps should either be reverted or documented.
Essentially, in
ErrorFormatter::Json
, the old behaviour (our app was on grapev0.10.1
) was to:Hash
as it is, or;{ error: original_error_object }
The commit linked has unfortunately changed this behaviour to be:
{ error: original_error_object }
ONLY IF the error object is aString
, or;I have checked the test changes in the same commit, as well as the changelog, and I could not see any obvious reference to this behavioural change.
I would love to know more about the intention behind this change, and see we either revert or document this change accordingly.
Hope that makes sense. Thanks everyone!
The text was updated successfully, but these errors were encountered: