using System;

namespace Wayne.Lib.StateEngine
{
    /// <summary>
    /// Exception transition is used when State engine issues a transition automatically because Enter() or HandleEvent() 
    /// throws an exception.
    /// </summary>
    public class ExceptionTransition : Transition
    {
        /// <summary>
        /// Exception that cause the transition
        /// </summary>
        public Exception Exception { get; set; }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="exception"></param>
        public ExceptionTransition(State sender, object type, Exception exception)
            : base(sender, type)
        {
            Exception = exception;
        }
    }
}