Created
August 26, 2010 14:01
-
-
Save pives/551431 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nemt.mmsweb.client.commands; | |
import net.customware.gwt.dispatch.shared.ActionException; | |
import com.allen_sauer.gwt.log.client.Log; | |
import com.google.gwt.user.client.Window; | |
import com.google.gwt.user.client.rpc.SerializationException; | |
/** | |
* @author Philip Ives | |
* | |
*This is the generic dispatched service call responder all Handlers should inherit this | |
*@version 1.0 | |
*/ | |
public abstract class CommandResponseHandler { | |
/** | |
* Only logs the throwable via GWT.log | |
* | |
* @param callFailure | |
*/ | |
public void onFailure(Throwable callFailure) { | |
if (Log.isDebugEnabled()) { | |
Log.debug("Call Failure",callFailure); | |
} | |
if (callFailure instanceof ActionException) { | |
error(callFailure.getMessage()); | |
} else if (callFailure instanceof SerializationException) { | |
error("Your application is out of date. Hit F5 to refresh or restart your browswer == Reason:" + callFailure.getMessage()); | |
} else { | |
Window.alert(callFailure.getMessage()); | |
} | |
} | |
public abstract void error(String error); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment