Skip to content

Commit f7556d0

Browse files
committed
code challenge 7 solution
1 parent 833b9c5 commit f7556d0

File tree

12 files changed

+519
-196
lines changed

12 files changed

+519
-196
lines changed

CODING-CHALLENGE-8.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# RESTful Webservices in Symfony
2+
3+
## Coding Challenge 8 - Error Handling
4+
5+
### Tasks
6+
7+
- centralize the error handling
8+
9+
### Solution
10+
11+
- throw a `ValidationFailedException` on validation errors
12+
- introduce an `ExceptionListener` to catch the `ValidationFailedException`
13+
- in the `ExceptionListener` create an error representation of the caught exception
14+
and fill the response content with it

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "project",
33
"license": "proprietary",
4-
"minimum-stability": "dev",
4+
"minimum-stability": "stable",
55
"prefer-stable": true,
66
"require": {
77
"php": ">=8",
@@ -26,6 +26,8 @@
2626
"symfony/proxy-manager-bridge": "5.4.*",
2727
"symfony/runtime": "5.4.*",
2828
"symfony/serializer": "5.4.*",
29+
"symfony/string": "5.4.*",
30+
"symfony/validator": "5.4.*",
2931
"symfony/yaml": "5.4.*",
3032
"webmozart/assert": "^1.10",
3133
"willdurand/negotiation": "^3.0"

0 commit comments

Comments
 (0)