Skip to content
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

Validation and related exception handling improvements #1439

Merged
merged 10 commits into from
Feb 6, 2024

Conversation

tylerwowen
Copy link
Contributor

@tylerwowen tylerwowen commented Feb 1, 2024

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:
Screenshot 2024-02-01 at 3 14 41 PM

Screenshot 2024-02-01 at 3 17 25 PM

@tylerwowen tylerwowen requested a review from a team as a code owner February 1, 2024 23:18
@github-actions github-actions bot added deploy-service Includes changes to deploy-service deploy-board Includes changes to deploy-board labels Feb 1, 2024
@tylerwowen tylerwowen merged commit 824f41f into master Feb 6, 2024
5 checks passed
@tylerwowen tylerwowen deleted the touyang/autopromote branch February 6, 2024 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-board Includes changes to deploy-board deploy-service Includes changes to deploy-service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants