Skip to content
Snippets Groups Projects
Commit 12ef4461 authored by kaloyane's avatar kaloyane
Browse files

[LMS-1719] expect the error to appear and handle it on the client side

SVN: 22132
parent 2ca8c0ee
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,9 @@ import com.extjs.gxt.ui.client.event.WindowListener; ...@@ -24,7 +24,9 @@ import com.extjs.gxt.ui.client.event.WindowListener;
import com.extjs.gxt.ui.client.widget.Dialog; import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.MessageBox; import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException;
import com.google.gwt.user.client.rpc.InvocationException; import com.google.gwt.user.client.rpc.InvocationException;
import com.google.gwt.user.client.rpc.SerializationException;
import ch.systemsx.cisd.common.shared.basic.utils.StringUtils; import ch.systemsx.cisd.common.shared.basic.utils.StringUtils;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils; import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.GWTUtils;
...@@ -207,6 +209,13 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> ...@@ -207,6 +209,13 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
public final void onFailure(final Throwable caught) public final void onFailure(final Throwable caught)
{ {
if (isIncompatibleServerException(caught))
{
String sessionExpiredMessage = getMessage(Dict.SESSION_EXPIRED_MESSAGE);
handleSessionTerminated(sessionExpiredMessage);
return;
}
final String msg; final String msg;
if (caught instanceof InvocationException) if (caught instanceof InvocationException)
{ {
...@@ -247,6 +256,12 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> ...@@ -247,6 +256,12 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
} }
} }
private boolean isIncompatibleServerException(final Throwable caught)
{
return caught instanceof SerializationException
|| caught instanceof IncompatibleRemoteServiceException;
}
private String getMessage(String messageKey, Object... params) private String getMessage(String messageKey, Object... params)
{ {
if (viewContext != null) if (viewContext != null)
......
...@@ -199,6 +199,8 @@ public abstract class Dict ...@@ -199,6 +199,8 @@ public abstract class Dict
public static final String EXCEPTION_WITHOUT_MESSAGE = "exception_withoutMessage"; public static final String EXCEPTION_WITHOUT_MESSAGE = "exception_withoutMessage";
public static final String SESSION_EXPIRED_MESSAGE = "session_expired";
// //
// Header // Header
// //
......
...@@ -168,6 +168,7 @@ var common = { ...@@ -168,6 +168,7 @@ var common = {
exception_invocationMessage: "Failed to contact the server. Please try again later or contact your administrator.", exception_invocationMessage: "Failed to contact the server. Please try again later or contact your administrator.",
exception_withoutMessage: "Unexpected error has occurred, please contact your administrator:<br>{0}", exception_withoutMessage: "Unexpected error has occurred, please contact your administrator:<br>{0}",
session_expired: "Session expired. Please login again.",
// //
// Header // Header
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment