Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CODING-CHALLENGE-8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# RESTful Webservices in Symfony

## Coding Challenge 8 - Error Handling

### Tasks

- centralize the error handling

### Solution

- throw a `ValidationFailedException` on validation errors
- introduce an `ExceptionListener` to catch the `ValidationFailedException`
- in the `ExceptionListener` create an error representation of the caught exception
and fill the response content with it
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8",
Expand All @@ -26,6 +26,8 @@
"symfony/proxy-manager-bridge": "5.4.*",
"symfony/runtime": "5.4.*",
"symfony/serializer": "5.4.*",
"symfony/string": "5.4.*",
"symfony/validator": "5.4.*",
"symfony/yaml": "5.4.*",
"webmozart/assert": "^1.10",
"willdurand/negotiation": "^3.0"
Expand Down
Loading