Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Misleading error PGRST121 #3404

Closed
bjornharrtell opened this issue Apr 11, 2024 · 2 comments · Fixed by #3423
Closed

Misleading error PGRST121 #3404

bjornharrtell opened this issue Apr 11, 2024 · 2 comments · Fixed by #3423
Assignees
Labels
difficulty: beginner Pure Haskell task enhancement a feature, ready for implementation messages user-facing error/informative messages

Comments

@bjornharrtell
Copy link

Environment

  • PostgreSQL version: 16
  • PostgREST version: 12.0.2

Description of issue

Response on error is The message and detail field of RAISE 'PGRST' error expects JSON but it apparently requires a specific schema for that JSON, fx. the detail JSON must be an object with status and headers fields.

@bjornharrtell bjornharrtell changed the title Misleading error PGRST121 on Misleading error PGRST121 Apr 11, 2024
@bjornharrtell
Copy link
Author

I now see this is clarified in the documentation, but I still think the error is misleading.

@laurenceisla laurenceisla added the messages user-facing error/informative messages label Apr 12, 2024
@laurenceisla
Copy link
Member

Yes, I think the "message" could be clarified and perhaps add the failed raised error to the "details". Something like this:

{
"message": "Could not parse JSON in the \"RAISE SQLSTATE 'PGRST'\" error",
"details": "Invalid JSON value for MESSAGE: {<here goes the failed MESSAGE>} and DETAIL: {<here goes the failed DETAIL>}",
...
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
difficulty: beginner Pure Haskell task enhancement a feature, ready for implementation messages user-facing error/informative messages
Development

Successfully merging a pull request may close this issue.

4 participants