Skip to content

Error response behaviour change in the JSON formatter #1309

Open
@fredwu

Description

@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 grape v0.10.1) was to:

  • pass on a Hash as it is, or;
  • wrap the error object (can be a string or array, etc - anything other than a hash) with { error: original_error_object }

The commit linked has unfortunately changed this behaviour to be:

  • wrap the error object with { error: original_error_object } ONLY IF the error object is a String, or;
  • anything else (a hash or an array, etc) will be passed on as they are

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions