/*
 * Copyright 2012, Red Hat, Inc. and individual contributors as indicated by the
 * @author tags. See the copyright.txt file in the distribution for a full
 * listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This software is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
 * site: http://www.fsf.org.
 */

package org.zanata.webtrans.client.rpc;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * @author Patrick Huang <a
 *         href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
 */
public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> {
    @Override
    public void onFailure(Throwable caught) {
        Log.error("failure", caught);
    }

}

@@ -1108,16 +1108,75 @@
 allback;
+%0Aimport com.google.gwt.user.client.rpc.StatusCodeException;
 %0A%0A/**%0A *
@@ -1421,27 +1421,703 @@
     
-Log.error(%22failure%22
+String className = getClass().getSimpleName();%0A        if (caught instanceof StatusCodeException) %7B%0A            StatusCodeException sce = (StatusCodeException) caught;%0A            if (sce.getStatusCode() == 0) %7B%0A                // This is typically caused by navigating away from%0A                // the GWT page, which cancels any outstanding AJAX calls%0A                // with code 0.%0A                // See https://code.google.com/p/google-web-toolkit/issues/detail?id=2858%0A                Log.info(%22GWT-RPC response code: 0 for %22 + %22class %22 +%0A                        className);%0A                return;%0A            %7D%0A        %7D%0A        Log.error(%22Async callback failure for class %22 + className
 , ca

Improve AJAX error logging