Hi Miguel,

This is a follow on to your comments in the Database Demo beautification
review.  I've made a simple change to replace the body of the app with an
error message when one of the first 2 database calls fails, which prevents
any UI components from being added to the window.  To test, I just corrupted
the SQL string.

A
gears/samples/database/src/com/google/gwt/gears/sample/database/client/DatabaseDemo.java

-Eric.
-- 
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Index: gears/samples/database/src/com/google/gwt/gears/sample/database/client/DatabaseDemo.java
===================================================================
--- gears/samples/database/src/com/google/gwt/gears/sample/database/client/DatabaseDemo.java	(revision 748)
+++ gears/samples/database/src/com/google/gwt/gears/sample/database/client/DatabaseDemo.java	(working copy)
@@ -23,6 +23,7 @@
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.KeyboardListener;
 import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
@@ -65,7 +66,9 @@
       db.open("database-demo");
       db.execute("create table if not exists Demo (Phrase varchar(255), Timestamp int)");
     } catch (DatabaseException e) {
-      Window.alert(e.toString());
+      RootPanel.get("demo").add(new HTML("Error opening or creating database: <font color=\"red\">" + e.toString() + "</font>"));
+      // Fatal error.  Do not build the interface.
+      return;
     }
 
     input.addKeyboardListener(new KeyboardListenerAdapter() {

Reply via email to