Skip to content

Commit bce5bcc

Browse files
committed
lint
1 parent a5ab539 commit bce5bcc

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

core/errors.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ API Platform automatically sends the appropriate HTTP status code to the client:
66
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)
77
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).
88

9-
# Errors
9+
# Errors
1010

1111
## Backward compatibility with < 3.1
1212

13-
Use the following configuration:
13+
Use the following configuration:
1414

1515
```yaml
1616
api_platform:
@@ -19,7 +19,7 @@ api_platform:
1919
rfc_7807_compliant_errors: false
2020
```
2121
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:
2323

2424
```php
2525
#[ApiResource(extraProperties: ['rfc_7807_compliant_errors' => false])
@@ -32,10 +32,8 @@ There are many ways of configuring the exception status code we recommend readin
3232
1. we look at `exception_to_status` and take one if there's a match
3333
2. If your exception is a `Symfony\Component\HttpKernel\Exception\HttpExceptionInterface` we get its status.
3434
3. If the exception is a `ApiPlatform\Metadata\Exception\ProblemExceptionInterface` and there is a status we use it
35-
4. Same for `ApiPlatform\Metadata\Exception\HttpExceptionInterface`
36-
5. We have some defaults:
37-
- `Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface` => 400
38-
- `ApiPlatform\Validator\Exception\ValidationException` => 422
35+
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
3937
6. the status defined on an `ErrorResource`
4038
7. 500 is the fallback
4139

@@ -178,7 +176,7 @@ the global config.
178176

179177
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`.
180178

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:
182180

183181
```php
184182
<?php
@@ -235,7 +233,7 @@ api_platform.validator.state.error_provider:
235233

236234
## Domain exceptions
237235

238-
Another way of having full control over domain exceptions is to create your own Error resource:
236+
Another way of having full control over domain exceptions is to create your own Error resource:
239237

240238
```php
241239
<?php

0 commit comments

Comments
 (0)