Skip to content

Conversation

@Artur-
Copy link
Member

@Artur- Artur- commented Jan 12, 2026

Prevents navigation corruption when error view's parent layout throws an exception during afterNavigation by catching the exception and rendering InternalServerError as fallback.

Fixes #22146

Prevents navigation corruption when error view's parent layout throws
an exception during afterNavigation by catching the exception and
rendering InternalServerError as fallback.

Fixes #22146
@sonarqubecloud
Copy link

@github-actions
Copy link

Test Results

1 311 files  ±0  1 311 suites  ±0   1h 14m 35s ⏱️ -59s
9 299 tests +1  9 231 ✅ +1  68 💤 ±0  0 ❌ ±0 
9 749 runs   - 5  9 673 ✅  - 5  76 💤 ±0  0 ❌ ±0 

Results for commit ebc3ca1. ± Comparison against base commit f10f150.

@Override
public void afterNavigation(AfterNavigationEvent event) {
events.add(event);
if (event.getLocation().getPath().equals("error")) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (event.getLocation().getPath().equals("error")) {
if (true) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't need the if at all. Can just throw the exception.

Comment on lines +309 to +314
// Error view threw an exception - fall back to
// InternalServerError
LoggerFactory.getLogger(Router.class).error(
"Exception occurred while rendering error view for '{}'. "
+ "Falling back to InternalServerError.",
location.getPath(), errorHandlingException);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original exception should also be logged as now it will disappear and only the exception failing the exception view rendering is logged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MainLayout unresponsive after unhandled exception in afterNavigation()

4 participants