From 86ed6cc475d9e9ee79fee4f2340c271ffa5c702e Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 2 Jan 2017 11:10:33 +0200 Subject: Call error handler for exceptions in UI.init() (#8055) Fixes #4995 --- .../java/com/vaadin/tests/components/ui/UIInitException.java | 10 ++++++++++ .../com/vaadin/tests/components/ui/UIInitExceptionTest.java | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'uitest') diff --git a/uitest/src/main/java/com/vaadin/tests/components/ui/UIInitException.java b/uitest/src/main/java/com/vaadin/tests/components/ui/UIInitException.java index d5f26ade29..fa25d7e837 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ui/UIInitException.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ui/UIInitException.java @@ -1,12 +1,22 @@ package com.vaadin.tests.components.ui; +import com.vaadin.server.ErrorHandler; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; public class UIInitException extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { + setErrorHandler(new ErrorHandler() { + @Override + public void error(com.vaadin.server.ErrorEvent event) { + addComponent(new Label("An exception occurred: " + + event.getThrowable().getMessage())); + + } + }); throw new RuntimeException("Catch me if you can"); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java index c1d6aaa55b..064132d4c7 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIInitExceptionTest.java @@ -3,9 +3,9 @@ package com.vaadin.tests.components.ui; import org.junit.Assert; import org.junit.Test; -import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.SingleBrowserTest; -public class UIInitExceptionTest extends MultiBrowserTest { +public class UIInitExceptionTest extends SingleBrowserTest { @Test public void testExceptionOnUIInit() throws Exception { openTestURL(); -- cgit v1.2.3