You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/errors.md
+7-9Lines changed: 7 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ API Platform automatically sends the appropriate HTTP status code to the client:
6
6
unexpected ones. It also provides a description of the error in [the Hydra error format](https://www.hydra-cg.com/spec/latest/core/#description-of-http-status-codes-and-errors)
7
7
or in the format described in the [RFC 7807](https://tools.ietf.org/html/rfc7807), depending of the format selected during the [content negotiation](content-negotiation.md).
8
8
9
-
# Errors
9
+
# Errors
10
10
11
11
## Backward compatibility with < 3.1
12
12
13
-
Use the following configuration:
13
+
Use the following configuration:
14
14
15
15
```yaml
16
16
api_platform:
@@ -19,7 +19,7 @@ api_platform:
19
19
rfc_7807_compliant_errors: false
20
20
```
21
21
22
-
This can also be configured on an `ApiResource` or in an `HttpOperation`, for example:
22
+
This can also be configured on an `ApiResource` or in an `HttpOperation`, for example:
4. Same for `ApiPlatform\Metadata\Exception\HttpExceptionInterface`
36
+
5. We have some defaults `Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface` => 400 and `ApiPlatform\Validator\Exception\ValidationException` => 422
39
37
6. the status defined on an `ErrorResource`
40
38
7. 500 is the fallback
41
39
@@ -178,7 +176,7 @@ the global config.
178
176
179
177
With `rfc_7807_compliant_errors` a few things happen. First Hydra exception are compatible with the JSON Problem specification. Default exception that are handled by API Platform in JSON will be returned as `application/problem+json`.
180
178
181
-
To customize the API Platform response, replace the `api_platform.state.error_provider` with your own provider:
179
+
To customize the API Platform response, replace the `api_platform.state.error_provider` with your own provider:
0 commit comments