-
Notifications
You must be signed in to change notification settings - Fork 7
Changed how exceptions are handled in InstantBook #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
230ae58
4992: Changed how exceptions are handled in InstantBook
tuj 15ecfdf
4992: Added error code
tuj dab0fd0
4992: Changed wording
tuj 16922e1
4992: Updated changelog
tuj 194111e
4992: Fixed how none existing resources are handled
tuj 3ac5c6a
4992: Avoid reporting a lot of errors. Reporting no booking options i…
tuj 9c56681
4992: Applied coding standards
tuj bab679a
4992: Cleanup
tuj 782eab2
4992: Cleaned up how exceptions are mapped to http exceptions
tuj 64ad721
4992: Applied coding standards
tuj 1e34cf2
4992: Fixed comment
tuj 7358230
4992: Fixed test issue
tuj acc47c4
4992: Removed status codes
tuj d07526c
4992: Fixed table name. Renamed index
tuj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,22 @@ api_platform: | |
email: [email protected] | ||
license: | ||
name: MIT | ||
|
||
# @see https://api-platform.com/docs/core/errors/#exception-to-status-configuration-using-symfony | ||
exception_to_status: | ||
# The 4 following handlers are registered by default, keep those lines to prevent unexpected side effects | ||
Symfony\Component\Serializer\Exception\ExceptionInterface: 400 # Use a raw status code (recommended) | ||
ApiPlatform\Exception\InvalidArgumentException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST | ||
ApiPlatform\ParameterValidator\Exception\ValidationExceptionInterface: 400 | ||
Doctrine\ORM\OptimisticLockException: 409 | ||
|
||
# Validation exception | ||
ApiPlatform\Validator\Exception\ValidationException: !php/const Symfony\Component\HttpFoundation\Response::HTTP_UNPROCESSABLE_ENTITY | ||
|
||
# App exception mappings | ||
App\Exceptions\BadRequestException: 400 | ||
App\Exceptions\ForbiddenException: 403 | ||
App\Exceptions\NotFoundException: 404 | ||
App\Exceptions\NotAcceptableException: 406 | ||
App\Exceptions\ConflictException: 409 | ||
App\Exceptions\TooManyRequestsException: 429 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Exceptions; | ||
|
||
class NotAcceptableException extends \Exception | ||
{ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Exceptions; | ||
|
||
class TooManyRequestsException extends \Exception | ||
{ | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why maintain the old name for the table? This should be a safe migration to make. https://mariadb.com/docs/server/reference/sql-statements/data-definition/rename-table