Enhancement: Graceful Handling of Missing Controller Classes in GroupedEndpointsFromApp #718
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.
Summary:
This pull request addresses an issue in the GroupedEndpointsFromApp class where an exception was thrown if a route's controller class couldn't be resolved. The existing code was modified to return null in such cases, allowing for a more graceful handling of the situation.
Changes Made:
The following changes have been made in this pull request:
Updated the code to return null if the route's controller class doesn't exist.
Motivation:
The original code was throwing an exception when the route's controller class couldn't be resolved, which could lead to unnecessary disruptions and confusion. By returning null instead of throwing an exception, the code now gracefully handles scenarios where the class is missing, without causing unexpected issues.
Testing:
The modified code has been tested with various route configurations, including cases where the controller class exists and where it doesn't. Unit tests have been added to ensure that the new behavior is correctly implemented and that the expected return values are achieved.
Additional Notes:
No other changes have been made to the codebase apart from the modifications mentioned above.