ErrorHandler

I have such View

@Slf4j
@PageTitle(PAGE_ERROR500_TITLE)
@HtmlImport("frontend://styles/shared-styles.html")
@SuppressWarnings("PMD.LinguisticNaming")
public class Error500View extends InternalServerError implements FlexComponent<Error500View> {

    public Error500View() {
...
    }

    @Override
    public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<Exception> parameter) {
        log.error(parameter.getCustomMessage(),parameter.getException());
        return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    }
}

How properly reroute errors on Error500View

VaadinSession.getCurrent().setErrorHandler((ErrorHandler) event -> {
            log.error(event.getThrowable().getMessage(), event.getThrowable());
            new Notification(event.getThrowable().getMessage(), backOfficeProperty.getNotification().getDelay(),
                    Position.TOP_END).open();
        });

If an unhandled exception is thrown during navigation to any of your routes, navigation is rerouted to your Error500View page automatically. You can try it by having one of your views or components implement BeforeEnterObserver and throwing an exception into the BeforeEnterObserver.beforeEnter method that your are going to implement.
InternalServerError
or any custom implementation of HasErrorParameter is intended to deal with unhandled exceptions thrown during navigation process.

More details you can find here https://vaadin.com/docs/v10/flow/routing/tutorial-routing-exception-handling.html

If an unhandled exception is thrown during navigation to any of your routes, navigation is rerouted to your Error500View page automatically.
yes this work well =)

But if I have such code

Button button = new Button("test");
button.addClickListener((ComponentEventListener<ClickEvent<Button>>) btnEvent -> {
	throw new MyOwnRuntimeEx("ERROR");
});

Can I be rerouted to Error500View?

As for now no, there is a ticket about it: https://github.com/vaadin/flow/issues/4715