Skip to content

Commit adfef6b

Browse files
authored
Update exceptions.md
1 parent 5492000 commit adfef6b

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

docs/book/v4/core-features/exceptions.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,43 @@ They provide a way to manage errors in a structured and controlled manner, separ
77

88
## How we use exceptions?
99

10-
When it comes to handling exceptions, DotKernel API relies on the usage of easy-to-understand, problem-specific exceptions.
10+
When it comes to handling exceptions, **DotKernel API** relies on the usage of easy-to-understand, problem-specific exceptions.
1111

12-
Ou-of-the-box we provide the following custom exceptions:
12+
Out-of-the-box we provide the following custom exceptions:
1313

14-
* `BadRequestException` thrown when:
14+
### `BadRequestException` thrown when:
1515

16-
1. client tries to create/update resource, but the data from the request is invalid/incomplete (example: client tries to create an account, but does not send the required `identity` field)
16+
* client tries to create/update resource, but the data from the request is invalid/incomplete (example: client tries to create an account, but does not send the required `identity` field)
17+
18+
### `ConflictException` thrown when:
1719

18-
* `ConflictException` thrown when:
20+
* resource cannot be created because a different resource with the same identifier already exists (example: cannot change existing user's identity because another user with the same identity already exists)
21+
* resource cannot change its state because it is already in the specified state (example: user cannot be activated because it is already active)
1922

20-
1. resource cannot be created because a different resource with the same identifier already exists (example: cannot change existing user's identity because another user with the same identity already exists)
21-
2. resource cannot change its state because it is already in the specified state (example: user cannot be activated because it is already active)
23+
### `ExpiredException` thrown when:
2224

23-
* `ExpiredException` thrown when:
25+
* resource cannot be accessed because it expired (example: account activation link)
26+
* resource cannot be accessed because it has been consumed (example: one-time password)
2427

25-
1. resource cannot be accessed because it expired (example: account activation link)
26-
2. resource cannot be accessed because it has been consumed (example: one-time password)
28+
### `ForbiddenException` thrown when:
2729

28-
* `ForbiddenException` thrown when:
30+
* resource cannot be accessed by the authenticated client (example: client authenticated as regular user sends a `GET /admin` request)
2931

30-
1. resource cannot be accessed by the authenticated client (example: client authenticated as regular user sends a `GET /admin` request)
32+
### `MethodNotAllowedException` thrown when:
3133

32-
* `MethodNotAllowedException` thrown when:
34+
* client tries to interact with a resource via an invalid HTTP request method (example: client sends a `PATCH /avatar` request)
3335

34-
1. client tries to interact with a resource via an invalid HTTP request method (example: client sends a `PATCH /avatar` request)
36+
### `NotFoundException` thrown when:
3537

36-
* `NotFoundException` thrown when:
38+
* client tries to interact with a resource that does not exist on the server (example: client sends a `GET /resource-does-not-exist` request)
3739

38-
1. client tries to interact with a resource that does not exist on the server (example: client sends a `GET /resource-does-not-exist` request)
40+
### `UnauthorizedException` thrown when:
3941

40-
* `UnauthorizedException` thrown when:
41-
42-
1. resource cannot be accessed because the client is not authenticated (example: unauthenticated client sends a `GET /admin` request)
42+
* resource cannot be accessed because the client is not authenticated (example: unauthenticated client sends a `GET /admin` request)
4343

4444
## How it works?
4545

46-
During a request, if there is no uncaught exception DotKernel API will return a JSON response with the data provided by the handler that handled the request.
46+
During a request, if there is no uncaught exception **DotKernel API** will return a JSON response with the data provided by the handler that handled the request.
4747

4848
Else, it will build and send a response based on the exception thrown:
4949

0 commit comments

Comments
 (0)