Skip to content

Different error codes in case of singular failure #4744

@steve-chavez

Description

@steve-chavez

Problem

When Singular fails, we return a 406 status code and:

{
  "code": "PGRST116",
  "message": "Cannot coerce the result to a single JSON object",
  "details": "The result contains 0 rows",
  "hint": null
}

But the error code doesn't differentiate between 0 or multiple rows, the only way to do is to parse the error message, which is fickle.

Solution

Return different error codes for each case, let's use the next available codes from group 1. PGRST129 for the 0 case and PGRST130 for multiple.

This would be a breaking change because PGRST116 would no longer be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeA bug fix or enhancement that would cause a breaking changeideaNeeds of discussion to become an enhancement, not ready for implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions