Skip to content

Commit

Permalink
refactoring: use CurrentInstace to preserve current UI
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Nov 28, 2023
1 parent 0a42d41 commit 5e6d203
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flow-server/src/main/java/com/vaadin/flow/component/UI.java
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,13 @@ public void handleError(Exception exception) {
ErrorHandlingCommand errorHandlingCommand = (ErrorHandlingCommand) command;
errorHandlingCommand.handleError(exception);
} else if (getSession() != null) {
UI.setCurrent(UI.this);
final Map<Class<?>, CurrentInstance> map = CurrentInstance
.setCurrent(UI.this);
try {
getSession().getErrorHandler()
.error(new ErrorEvent(exception));
} finally {
UI.setCurrent(null);
CurrentInstance.restoreInstances(map);
}
} else {
/*
Expand Down

0 comments on commit 5e6d203

Please sign in to comment.