fix: clarify PGRST116 error message (#3795)

Currently it's redundant and not easy to read.

```
{"message":"JSON object requested, multiple (or no) rows returned",
"details":"The result contains 2 rows"}
```

Now:

```
{"message":"Cannot coerce the result to a single JSON object",
"details":"The result contains an array of 0 objects"}
``

Also correct docs which had a wrong error code.
This commit is contained in:
Steve Chavez
2024-11-20 12:15:46 -05:00
committed by GitHub
parent e929834f82
commit 6db245aacd
5 changed files with 23 additions and 24 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ instance JSON.ToJSON ApiRequestError where
toJSON (SingularityError n) = toJsonPgrstError
ApiRequestErrorCode16
"JSON object requested, multiple (or no) rows returned"
"Cannot coerce the result to a single JSON object"
(Just $ JSON.String $ T.unwords ["The result contains", show n, "rows"])
Nothing