/*******************************************************************************
* Copyright (c) 2012-2015 Codenvy, S.A.
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.ide.job;
import org.eclipse.che.ide.rest.RequestStatusHandler;
import com.google.web.bindery.event.shared.EventBus;
/**
* Standard handling of errors for {@link RequestStatusHandler} interface
*
* @author <a href="mailto:evidolob@exoplatform.com">Evgen Vidolob</a>
* @version $Id: Oct 31, 2011 evgen $
*/
public abstract class RequestStatusHandlerBase implements RequestStatusHandler {
protected String projectName;
protected EventBus eventBus;
/** @param projectName */
public RequestStatusHandlerBase(String projectName, EventBus eventBus) {
super();
this.projectName = projectName;
this.eventBus = eventBus;
}
/** {@inheritDoc} */
@Override
public void requestError(String id, Throwable exception) {
Job job = new Job(id, Job.JobStatus.ERROR);
job.setError(exception);
eventBus.fireEvent(new JobChangeEvent(job));
}
}