-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validation and related exception handling improvements (#1439)
# Changes ## Deploy board ### Front end Slightly improved the UI for displaying auto promotion config change failures. ### Back end The code base doesn't handle `IllegalArgumentException` everywhere. Changed `IllegalArgumentException` to a subclass of `TeletraanException`, so it can be handled whenever `TeletraanException` is handled. This works because the handling is the same - show users the error. ## Teletraan service ### Validation Added constraints to the `PromoteBean`. When users tried to save an invalid schedule, it will be rejected by validation ### Exception handling Added `JerseyViolationExceptionMapper` and removed our own handling in `GenericExceptionMapper`. `JerseyViolationExceptionMapper` is simply better and it provides a Json as the response body (v.s. plain text). Additionally, without `JerseyViolationExceptionMapper` and when an invalid input is caught by validation, the service simply returns 400 without any message, because Jersey's own `ConstraintViolationExceptionMapper` handles the exception without invoking our `GenericExceptionMapper`. ### Junit 5 Added Junit 5 and used it in the resources tests. Note that Junit 5 can run in parallel with Junit 4. # Validations and tests Currently, there is no validation. Users can save any schedule and they won't know if it is a valid one. With this change: <img width="1653" alt="Screenshot 2024-02-01 at 3 14 41 PM" src="https://github.com/pinterest/teletraan/assets/8442875/96399806-15a2-43b5-87f2-ece9f11ce676"> <img width="1204" alt="Screenshot 2024-02-01 at 3 17 25 PM" src="https://github.com/pinterest/teletraan/assets/8442875/97c5cda5-46f1-4daa-b093-e70c0b4052cc">
- Loading branch information
1 parent
cda241c
commit 824f41f
Showing
14 changed files
with
224 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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
Oops, something went wrong.