Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElshad Seyidmammadov2016-03-22 04:47:21 -0400
committerGerrit Code Review @ Eclipse.org2016-03-24 07:34:17 -0400
commit832dedddd923821e470d82e58e967d1e69863751 (patch)
tree3a5c9311d83e618655184cadd7cdf350c1c318e4 /bundles
parent2e1230e8bc9f5348aad389e0ace82d63700b73e2 (diff)
downloadorg.eclipse.rap-832dedddd923821e470d82e58e967d1e69863751.tar.gz
org.eclipse.rap-832dedddd923821e470d82e58e967d1e69863751.tar.xz
org.eclipse.rap-832dedddd923821e470d82e58e967d1e69863751.zip
Show a dialog-like box for client/server errors
For some errors we show a dialog-like box with an option to restart the application, for other a white page with details about client/server crash without an option to restart the application. It's better to handle all the errors in the same way. In case of client/server error, where the details about the crash are important, we add a separate "Details" button to the error box to show them. Update all places on the client to use the new error box for client/server errors. Add additional message for client error description. Change-Id: I09477ce16e0e3caccbbc8f62dc8b938fac1965d5 Signed-off-by: Elshad Seyidmammadov <elshad@eclipsesource.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/client/ClientMessages.js5
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js4
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/remote/Connection.js6
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/runtime/ErrorHandler.js40
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.java7
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.properties5
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/client/WebClientMessages.java3
7 files changed, 48 insertions, 22 deletions
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/client/ClientMessages.js b/bundles/org.eclipse.rap.rwt/js/rwt/client/ClientMessages.js
index 825bba8acf..614f58f2c6 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/client/ClientMessages.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/client/ClientMessages.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2015 EclipseSource and others.
+ * Copyright (c) 2013, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,9 +20,10 @@ rwt.client.ClientMessages = function() {
"SessionTimeout" : "Session Timeout",
"SessionTimeoutDescription" : "The server session timed out.",
"ClientError" : "Client Error",
+ "ClientErrorDescription" : "The application terminated unexpectedly.",
"Retry" : "Retry",
"Restart" : "Restart",
- "Details" : "Details:"
+ "Details" : "Details"
};
};
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js b/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js
index bafd46c246..149c711f9e 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 EclipseSource and others.
+ * Copyright (c) 2011, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -82,7 +82,7 @@ rwt.client.ServerPush.prototype = {
_handleServerError : function( event ) {
var text = event.responseText;
if( text && text.length > 0 ) {
- rwt.runtime.ErrorHandler.showErrorPage( text );
+ rwt.runtime.ErrorHandler.showErrorBox( "server error", true, text );
} else {
rwt.runtime.ErrorHandler.showErrorBox( "request failed" );
}
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/remote/Connection.js b/bundles/org.eclipse.rap.rwt/js/rwt/remote/Connection.js
index 803b5e30af..6d9f89b062 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/remote/Connection.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/remote/Connection.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2002, 2016 Innoopract Informationssysteme GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -196,7 +196,7 @@ rwt.qx.Class.define( "rwt.remote.Connection", {
var messageObject = JSON.parse( text );
ErrorHandler.showErrorBox( messageObject.head.error, true );
} else {
- ErrorHandler.showErrorPage( text );
+ ErrorHandler.showErrorBox( "server error", true, text );
}
} else {
ErrorHandler.showErrorBox( "request failed" );
@@ -219,8 +219,8 @@ rwt.qx.Class.define( "rwt.remote.Connection", {
that._hideWaitHint();
} );
} catch( ex ) {
- ErrorHandler.processJavaScriptErrorInResponse( event.responseText, ex, event.target );
this._hideWaitHint();
+ ErrorHandler.processJavaScriptErrorInResponse( event.responseText, ex, event.target );
}
},
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/runtime/ErrorHandler.js b/bundles/org.eclipse.rap.rwt/js/rwt/runtime/ErrorHandler.js
index 045f50179e..6963f4e5d8 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/runtime/ErrorHandler.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/runtime/ErrorHandler.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 EclipseSource and others.
+ * Copyright (c) 2011, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
processJavaScriptErrorInResponse : function( script, error, currentRequest ) {
var content = this._getErrorPageHeader();
content += "<pre>" + this._gatherErrorDetails( error, script, currentRequest ) + "</pre>";
- this.showErrorPage( content );
+ this.showErrorBox( "client error", true, content );
},
processJavaScriptError : function( error ) {
@@ -48,7 +48,7 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
if( debug ) {
var content = this._getErrorPageHeader();
content += "<pre>" + this._gatherErrorDetails( error ) + "</pre>";
- this.showErrorPage( content );
+ this.showErrorBox( "client error", true, content );
throw error;
}
},
@@ -60,7 +60,7 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
this._createErrorPageArea().innerHTML = content;
},
- showErrorBox : function( errorType, freeze ) {
+ showErrorBox : function( errorType, freeze, errorDetails ) {
if( freeze ) {
this._freezeApplication();
}
@@ -78,14 +78,29 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
this._description = this._createErrorBoxDescriptionArea( this._box );
this._description.innerHTML = errorBoxData.description;
this._action = this._createErrorBoxActionArea( this._box );
- if( errorBoxData.action ) {
- this._action.innerHTML = errorBoxData.action;
+ var actions = errorBoxData.action;
+ if( errorDetails && errorDetails.trim().length > 0 ) {
+ actions += this._getDetailsAction();
+ }
+ if( actions ) {
+ this._action.innerHTML = actions;
}
var hyperlink = this._action.getElementsByTagName( "a" )[ 0 ];
if( hyperlink ) {
this._styleHyperlinkAsButton( hyperlink );
hyperlink.focus();
}
+ var detailsHyperlink = document.getElementById( "rwt_detailsActionHyperlink" );
+ if( detailsHyperlink ) {
+ this._styleHyperlinkAsButton( detailsHyperlink );
+ var self = this;
+ detailsHyperlink.addEventListener( "click", function() { self.showErrorPage( errorDetails ); } );
+ }
+ },
+
+ _getDetailsAction : function() {
+ var detailsMessage = rwt.client.ClientMessages.getInstance().getMessage( "Details" );
+ return "<a id=\"rwt_detailsActionHyperlink\" href=\"javascript:void(0)\">" + detailsMessage + "</a>";
},
showWaitHint : function() {
@@ -117,7 +132,7 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
_getErrorPageHeader : function() {
var errorBoxData = this._getErrorBoxData( "client error" );
var result = "<h2>" + errorBoxData.title + "</h2>";
- result += "<h3>" + errorBoxData.action + "</h3>";
+ result += "<h3>" + errorBoxData.details + "</h3>";
result += "<hr/>";
return result;
},
@@ -295,7 +310,9 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
_getErrorBoxData : function( errorType ) {
var result = {
title : "",
- description : ""
+ description : "",
+ details : "",
+ action : ""
};
var messages = rwt.client.ClientMessages.getInstance();
switch( errorType ) {
@@ -320,10 +337,14 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
break;
case "client error":
result.title = messages.getMessage( "ClientError" );
- result.action = messages.getMessage( "Details" );
+ result.description = messages.getMessage( "ClientErrorDescription" );
+ result.details = messages.getMessage( "Details" );
+ result.action = "<a href=\"" + this._getRestartURL() + "\">"
+ + messages.getMessage( "Restart" ) + "</a>";
break;
default:
result.title = messages.getMessage( "ServerError" );
+ result.description = messages.getMessage( "ServerErrorDescription" );
result.action = "<a href=\"" + this._getRestartURL() + "\">"
+ messages.getMessage( "Restart" ) + "</a>";
}
@@ -348,6 +369,7 @@ rwt.qx.Class.define( "rwt.runtime.ErrorHandler", {
style.backgroundColor = "#E8E8E8";
style.color = "#4a4a4a";
style.padding = "5px 15px";
+ style.margin = "5px";
style.borderTop = "1px solid #CCCCCC";
style.borderRight = "1px solid #333333";
style.borderBottom = "1px solid #333333";
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.java
index 5028ba0865..7a0f39345c 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2008, 2016 Innoopract Informationssysteme GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,6 +29,7 @@ public final class RWTMessages {
public static final String SESSION_TIMEOUT = "SessionTimeout";
public static final String SESSION_TIMEOUT_DESCRIPTION = "SessionTimeoutDescription";
public static final String CLIENT_ERROR = "ClientError";
+ public static final String CLIENT_ERROR_DESCRIPTION = "ClientErrorDescription";
public static final String RETRY = "Retry";
public static final String RESTART = "Restart";
public static final String DETAILS = "Details";
@@ -55,13 +56,13 @@ public final class RWTMessages {
ResourceBundle bundle = null;
try {
bundle = getBundle( bundleName, locale );
- } catch( MissingResourceException ex ) {
+ } catch( @SuppressWarnings( "unused" ) MissingResourceException ex ) {
result = key + " (no resource bundle)";
}
if( bundle != null ) {
try {
result = bundle.getString( key );
- } catch( MissingResourceException mre ) {
+ } catch( @SuppressWarnings( "unused" ) MissingResourceException mre ) {
}
}
return result;
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.properties b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.properties
index 80d64bb5a0..ca4d6eab21 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.properties
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTMessages.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2008, 2015 Innoopract Informationssysteme GmbH and others.
+# Copyright (c) 2008, 2016 Innoopract Informationssysteme GmbH and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -17,9 +17,10 @@ ConnectionErrorDescription = The server seems to be temporarily unavailable.
SessionTimeout = Session Timeout
SessionTimeoutDescription = The server session timed out.
ClientError = Client Error
+ClientErrorDescription = The application terminated unexpectedly.
Retry = Retry
Restart = Restart
-Details = Details:
+Details = Details
NoScriptWarning = Your browser or browser-setup is not supported. <br />\
Please use one of: IE 9+, Firefox 23+, Safari 6+, Google Chrome 29+ or Opera 15+.<br />\
Ensure that Javascript is enabled and XMLHttpRequests are allowed.
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/client/WebClientMessages.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/client/WebClientMessages.java
index 618073726b..141a4359ca 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/client/WebClientMessages.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/client/WebClientMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2015 EclipseSource and others.
+ * Copyright (c) 2013, 2016 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,7 @@ public class WebClientMessages implements ClientMessages {
RWTMessages.SESSION_TIMEOUT,
RWTMessages.SESSION_TIMEOUT_DESCRIPTION,
RWTMessages.CLIENT_ERROR,
+ RWTMessages.CLIENT_ERROR_DESCRIPTION,
RWTMessages.RETRY,
RWTMessages.RESTART,
RWTMessages.DETAILS

Back to the top