package eu.dnetlib.espas.gui.shared;

import com.google.gwt.user.client.rpc.IsSerializable;

@SuppressWarnings("serial")
public class DownloadManagerException extends Exception implements IsSerializable {

	public enum ErrorCode implements IsSerializable {
		REQUEST_ALREADY_EXISTS,
		SQL_ERROR,
		DOWNLOAD_FAILED,
		REQUEST_TOO_LARGE,
		TERMS_NOT_AGREED
	}
	
	private ErrorCode errorCode = null;
	
	public DownloadManagerException() {
	}
	
	public DownloadManagerException(ErrorCode errorCode) {
		this.errorCode = errorCode;
	}

	public DownloadManagerException(String message, Throwable cause, ErrorCode errorCode) {
		super(message, cause);
		
		this.errorCode = errorCode;
	}

	public DownloadManagerException(String message, ErrorCode errorCode) {
		super(message);
		
		this.errorCode = errorCode;
	}

	public DownloadManagerException(Throwable cause, ErrorCode errorCode) {
		super(cause);
		
		this.errorCode = errorCode;
	}

	public ErrorCode getErrorCode() {
		return errorCode;
	}
}
