コード例 #1
0
ファイル: OneForOne.cs プロジェクト: mlambda-net/MLambda
        /// <summary>
        /// Handles the exception.
        /// </summary>
        /// <param name="exception">the exception.</param>
        /// <param name="process">the process.</param>
        /// <exception cref="ArgumentOutOfRangeException">Invalid enumeration type.</exception>
        public void Handle(Exception exception, IProcess process)
        {
            switch (this.decider.Decision(exception))
            {
            case Directive.Restart:
                process.Restart();
                break;

            case Directive.Resume:
                process.Resume();
                break;

            case Directive.Stop:
                process.Stop();
                break;

            case Directive.Escalate:
                process.Escalate(exception);
                break;

            default:
                throw new InvalidOperationException(nameof(Directive));
            }
        }