-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add the number of rows affected in hint field of response of SingularityError #2874
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -69,7 +69,7 @@ spec = | |||||
[("Prefer", "tx=commit"), singular] | ||||||
[json| { address: "zzz" } |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 4 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 4 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"4"}|] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, just noticing that we already have the affected rows on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I understood that it was already present in the details, as shown in the issue's OP, but that an easy access to the number of rows was needed (as an alternative to the But maybe that wasn't contemplated in the issue too. |
||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
@@ -85,7 +85,7 @@ spec = | |||||
[("Prefer", "tx=commit"), ("Prefer", "return=representation"), singular] | ||||||
[json| { address: "zzz" } |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 4 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 4 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"4"}|] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @taimoorzaeem Besides the hint (which is likely unnecessary now), we can make an improvement to the error message:
Suggested change
The reasoning is that I've been noticing that users ignore the error message when they see the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also technically the error message is not accurate since it should refer to json array elements or array length and not "rows". It could be reworded. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @steve-chavez "rows" is more consistent with other error messages and also since "rows" refer to the rows returned from the database so it is accurate IMO. Perhaps maybe no need to reword that. |
||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
@@ -100,7 +100,7 @@ spec = | |||||
request methodPatch "/items?id=gt.0&id=lt.0" | ||||||
[singular] [json|{"id":1}|] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"0"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -109,7 +109,7 @@ spec = | |||||
request methodPatch "/items?id=gt.0&id=lt.0" | ||||||
[("Prefer", "return=representation"), singular] [json|{"id":1}|] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"0"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -141,7 +141,7 @@ spec = | |||||
[("Prefer", "tx=commit"), singular] | ||||||
[json| [ { id: 200, address: "xxx" }, { id: 201, address: "yyy" } ] |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"2"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
@@ -157,7 +157,7 @@ spec = | |||||
[("Prefer", "tx=commit"), ("Prefer", "return=representation"), singular] | ||||||
[json| [ { id: 202, address: "xxx" }, { id: 203, address: "yyy" } ] |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"2"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
@@ -173,7 +173,7 @@ spec = | |||||
[("Prefer", "tx=commit"), ("Prefer", "return=minimal"), singular] | ||||||
[json| [ { id: 204, address: "xxx" }, { id: 205, address: "yyy" } ] |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"2"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
@@ -189,7 +189,7 @@ spec = | |||||
[singular] | ||||||
[json| [ ] |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"0"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -199,7 +199,7 @@ spec = | |||||
[("Prefer", "return=representation"), singular] | ||||||
[json| [ ] |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"0"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -222,7 +222,7 @@ spec = | |||||
[("Prefer", "tx=commit"), singular] | ||||||
"" | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 5 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 5 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"5"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
@@ -240,7 +240,7 @@ spec = | |||||
request methodDelete "/items?id=gt.5&id=lt.11" | ||||||
[("Prefer", "tx=commit"), ("Prefer", "return=representation"), singular] "" | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 5 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 5 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"5"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
@@ -257,7 +257,7 @@ spec = | |||||
request methodDelete "/items?id=lt.0" | ||||||
[singular] "" | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"0"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -266,7 +266,7 @@ spec = | |||||
request methodDelete "/items?id=lt.0" | ||||||
[("Prefer", "return=representation"), singular] "" | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"0"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -276,7 +276,7 @@ spec = | |||||
request methodPost "/rpc/getproject" | ||||||
[singular] [json|{ "id": 9999999}|] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 0 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"0"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -299,7 +299,7 @@ spec = | |||||
request methodPost "/rpc/getallprojects" | ||||||
[singular] "{}" | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 5 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 5 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"5"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [matchContentTypeSingular] | ||||||
} | ||||||
|
@@ -314,7 +314,7 @@ spec = | |||||
[("Prefer", "tx=commit"), singular] | ||||||
[json| {"id_l": 1, "id_h": 2, "name": "changed"} |] | ||||||
`shouldRespondWith` | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":null}|] | ||||||
[json|{"details":"Results contain 2 rows, application/vnd.pgrst.object+json requires 1 row","message":"JSON object requested, multiple (or no) rows returned","code":"PGRST116","hint":"2"}|] | ||||||
{ matchStatus = 406 | ||||||
, matchHeaders = [ matchContentTypeSingular | ||||||
, "Preference-Applied" <:> "tx=commit" ] | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SingularityError
may confuse users, because it's an internal identifier in the code.