/*
 * Created on Oct 14, 2008 (C) Copyright TANDBERG Television Ltd.
 */

package com.tandbergtv.watchpoint.pmm.title;

import com.tandbergtv.watchpoint.pmm.util.validation.ValidationMessage;

/**
 * Exception thrown by the ITitleService implementation that contains a Validation Error Message
 * providing a error code that can be localized.
 * 
 * @author Vijay Silva
 */
public class TitleServiceException extends RuntimeException {

	/* Serialization UID */
	private static final long serialVersionUID = 4093167470405544953L;

	private ValidationMessage failureMessage;

	/**
	 * @param errorMessage The validation message object containing the error code
	 * @param message The detail message
	 */
	public TitleServiceException(ValidationMessage errorMessage, String message) {
		super(message);

		setFailureMessage(errorMessage);
	}

	/**
	 * @param errorMessage The validation message object containing the error code
	 * @param cause The cause for this exception
	 */
	public TitleServiceException(ValidationMessage errorMessage, Throwable cause) {
		super(cause);

		setFailureMessage(errorMessage);
	}

	/**
	 * @param errorMessage The validation message object containing the error code
	 * @param message The detail message
	 * @param cause The cause for this exception
	 */
	public TitleServiceException(ValidationMessage errorMessage, String message, Throwable cause) {
		super(message, cause);

		setFailureMessage(errorMessage);
	}

	/**
	 * Gets the Failure Message
	 * 
	 * @return The Failure Message
	 */
	public ValidationMessage getFailureMessage() {
		return failureMessage;
	}

	protected void setFailureMessage(ValidationMessage message) {
		this.failureMessage = message;
	}
}
