Why setDefaultErrorHandler crash my view in vaadin flow?

I wrote my own custom error handler for the UI in Vaadin flow. But when I throw the exception my view crash and not show my human readable error message.

I did this in other application using Vaadin 8 and works perfectly. The idea its throw a SgiException in my backend services like:

  • Product not found
  • Incorrect value for field “XXX”
  • Not available stock for the product.
  • etc.

And then show a system notification

public static void setDefaultErrorHandler(ErrorEvent errorEvent) {

            Throwable t = DefaultErrorHandler.findRelevantThrowable(errorEvent.getThrowable());

            String message;
            if (t != null) {
                message = t.getMessage();
            } else {
                message = "";

            log.error(message, t);

            SgiException sgiException = getCauseOfType(t, SgiException.class);
            if (sgiException != null) {
                NotificationBuilder.exception(sgiException.getCode(), sgiException.getMessage());
            } else {
                NotificationBuilder.exception(UNKNOW_ERROR, (message == null ? "" : message));

        private static <T extends Throwable> T getCauseOfType(Throwable th, Class<T> type) {
            while (th != null) {
                if (type.isAssignableFrom(th.getClass())) {
                    return (T) th;
                } else {
                    th = th.getCause();
            return null;

And this is how I set the custom error handler:

        public void configBaseView() {

In the view show this instead of my notification:


Note: Debugging the application, seeing the code it’s running, looks the method its called for some reason not show the notification.

There is some issues reported regarding this functionality, you could double check if this is a match https://github.com/vaadin/flow/issues/801