Skip to content

Instantly share code, notes, and snippets.

@pives
Created August 26, 2010 14:01
Show Gist options
  • Save pives/551431 to your computer and use it in GitHub Desktop.
Save pives/551431 to your computer and use it in GitHub Desktop.
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