@@ -59,28 +59,29 @@ class (JSON.ToJSON a) => PgrstError a where
59
59
errorResponseFor err = responseLBS (status err) (headers err) $ errorPayload err
60
60
61
61
instance PgrstError ApiRequestError where
62
- status AmbiguousRelBetween {} = HTTP. status300
63
- status AmbiguousRpc {} = HTTP. status300
64
- status BinaryFieldError {} = HTTP. status406
65
- status MediaTypeError {} = HTTP. status415
66
- status InvalidBody {} = HTTP. status400
67
- status InvalidFilters = HTTP. status405
68
- status InvalidRpcMethod {} = HTTP. status405
69
- status InvalidRange {} = HTTP. status416
70
- status NotFound = HTTP. status404
71
-
72
- status NoRelBetween {} = HTTP. status400
73
- status NoRpc {} = HTTP. status404
74
- status NotEmbedded {} = HTTP. status400
75
- status PutRangeNotAllowedError = HTTP. status400
76
- status QueryParamError {} = HTTP. status400
77
- status RelatedOrderNotToOne {} = HTTP. status400
78
- status SpreadNotToOne {} = HTTP. status400
79
- status UnacceptableFilter {} = HTTP. status400
80
- status UnacceptableSchema {} = HTTP. status406
81
- status UnsupportedMethod {} = HTTP. status405
82
- status LimitNoOrderError = HTTP. status400
83
- status ColumnNotFound {} = HTTP. status400
62
+ status AmbiguousRelBetween {} = HTTP. status300
63
+ status AmbiguousRpc {} = HTTP. status300
64
+ status BinaryFieldError {} = HTTP. status406
65
+ status BulkLimitNotAllowedError = HTTP. status400
66
+ status MediaTypeError {} = HTTP. status415
67
+ status InvalidBody {} = HTTP. status400
68
+ status InvalidFilters = HTTP. status405
69
+ status InvalidRpcMethod {} = HTTP. status405
70
+ status InvalidRange {} = HTTP. status416
71
+ status NotFound = HTTP. status404
72
+
73
+ status NoRelBetween {} = HTTP. status400
74
+ status NoRpc {} = HTTP. status404
75
+ status NotEmbedded {} = HTTP. status400
76
+ status PutRangeNotAllowedError = HTTP. status400
77
+ status QueryParamError {} = HTTP. status400
78
+ status RelatedOrderNotToOne {} = HTTP. status400
79
+ status SpreadNotToOne {} = HTTP. status400
80
+ status UnacceptableFilter {} = HTTP. status400
81
+ status UnacceptableSchema {} = HTTP. status406
82
+ status UnsupportedMethod {} = HTTP. status405
83
+ status LimitNoOrderError = HTTP. status400
84
+ status ColumnNotFound {} = HTTP. status400
84
85
85
86
headers _ = [MediaType. toContentType MTApplicationJSON ]
86
87
@@ -172,6 +173,12 @@ instance JSON.ToJSON ApiRequestError where
172
173
" details" .= (" Only is null or not is null filters are allowed on embedded resources" :: Text ),
173
174
" hint" .= JSON. Null ]
174
175
176
+ toJSON BulkLimitNotAllowedError = JSON. object [
177
+ " code" .= ApiRequestErrorCode21 ,
178
+ " message" .= (" Range header and limit/offset querystring parameters are not allowed for PATCH with Prefer: params=multiple-objects" :: Text ),
179
+ " details" .= JSON. Null ,
180
+ " hint" .= JSON. Null ]
181
+
175
182
toJSON (NoRelBetween parent child embedHint schema allRels) = JSON. object [
176
183
" code" .= SchemaCacheErrorCode00 ,
177
184
" message" .= (" Could not find a relationship between '" <> parent <> " ' and '" <> child <> " ' in the schema cache" :: Text ),
@@ -598,6 +605,7 @@ data ErrorCode
598
605
| ApiRequestErrorCode18
599
606
| ApiRequestErrorCode19
600
607
| ApiRequestErrorCode20
608
+ | ApiRequestErrorCode21
601
609
-- Schema Cache errors
602
610
| SchemaCacheErrorCode00
603
611
| SchemaCacheErrorCode01
@@ -644,6 +652,7 @@ buildErrorCode code = "PGRST" <> case code of
644
652
ApiRequestErrorCode18 -> " 118"
645
653
ApiRequestErrorCode19 -> " 119"
646
654
ApiRequestErrorCode20 -> " 120"
655
+ ApiRequestErrorCode21 -> " 121"
647
656
648
657
SchemaCacheErrorCode00 -> " 200"
649
658
SchemaCacheErrorCode01 -> " 201"
0 commit comments