How to replace "Internal error" popup with automatic page refresh

Hey,

is it possible, and how, to replace default “Internal error, please notify adminstrator …” popup with automatic page refresh?
I’m getting some strange client side errors that I don’t really have time to solve right now.
Can I straight up call page refresh with JS by using the following code:

private void attached() {
		UI.getCurrent().getSession().getService().setSystemMessagesProvider(new SystemMessagesProvider() {
			
			@Override
			public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
				logger.error(systemMessagesInfo.toString());
				UI.getCurrent().getPage().executeJs("something someting");
				CustomizedSystemMessages c = new CustomizedSystemMessages();
				return c;
			}
		});
	}

17978097.jpg

Maybe using the JS command location.reload() could help (didn’t try it myself). https://www.w3schools.com/jsref/met_loc_reload.asp

Stefan Uebe:
Maybe using the JS command location.reload() could help (didn’t try it myself). https://www.w3schools.com/jsref/met_loc_reload.asp

Yes I’m aware of the location.reload() call but I was wondering if anyone actually knows if this is the correct way to do this?

If you set the CustomizedSystemMessages’s relevant message and caption to null, it should automatically redirect to the URL. For example:

CustomizedSystemMessages messages = new CustomizedSystemMessages();
messages.setSessionExpiredMessage(null);
messages.setSessionExpiredCaption(null);
messages.setSessionExpiredURL("some-url");

In this case, a session expired message should automatically result into navigation to some-url. Same goes for the other message types in CustomizedSystemMessages.

Thanks, I’ll give it a shot!