Add 'PGRST' error code to differentiate from PostgreSQL errors

This commit is contained in:
Laurence Isla
2022-03-04 15:57:38 -05:00
committed by GitHub
parent 99d0b805df
commit d6834e8bf8
17 changed files with 399 additions and 156 deletions
+9 -3
View File
@@ -296,15 +296,21 @@ spec actualPgVersion = describe "json and jsonb operators" $ do
get "/json_arr?select=data->>-78xy" `shouldRespondWith`
[json|
{"details": "unexpected 'x' expecting digit, \"->\", \"::\", \".\", \",\" or end of input",
"message": "\"failed to parse select parameter (data->>-78xy)\" (line 1, column 11)"} |]
"message": "\"failed to parse select parameter (data->>-78xy)\" (line 1, column 11)",
"code": "PGRST100",
"hint": null} |]
{ matchStatus = 400, matchHeaders = [matchContentTypeJson] }
get "/json_arr?select=data->>--34" `shouldRespondWith`
[json|
{"details": "unexpected \"-\" expecting digit",
"message": "\"failed to parse select parameter (data->>--34)\" (line 1, column 9)"} |]
"message": "\"failed to parse select parameter (data->>--34)\" (line 1, column 9)",
"code": "PGRST100",
"hint": null} |]
{ matchStatus = 400, matchHeaders = [matchContentTypeJson] }
get "/json_arr?select=data->>-xy-4" `shouldRespondWith`
[json|
{"details":"unexpected \"x\" expecting digit",
"message":"\"failed to parse select parameter (data->>-xy-4)\" (line 1, column 9)"} |]
"message":"\"failed to parse select parameter (data->>-xy-4)\" (line 1, column 9)",
"code": "PGRST100",
"hint": null} |]
{ matchStatus = 400, matchHeaders = [matchContentTypeJson] }