private ExceptionHandlerData GetExceptionHandlerData(ExceptionHandlingSettings settings, string policyName, string exceptionTypeName, string handlerName) { ExceptionHandlerDataCollection exceptionHandlerDataCollection = GetExceptionHandlerDataCollection(settings, policyName, exceptionTypeName); ExceptionHandlerData data = exceptionHandlerDataCollection[handlerName]; if (data == null) { throw new ConfigurationException(SR.ExceptionExceptionHanlderNotFoun(handlerName, exceptionTypeName, policyName)); } return(data); }
/// <summary> /// Creates all configured <see cref="IExceptionHandler"/> objects. /// </summary> /// <param name="policyName"><para>The policy name to create the handler.</para></param> /// <param name="exceptionTypeName"><para>The type of exception requested to be handled.</para></param> /// <returns>An array of <see cref="IExceptionHandler"/> objects.</returns> public IExceptionHandler[] CreateExceptionHandlers(string policyName, string exceptionTypeName) { ValidatePolicyAndExceptionType(policyName, exceptionTypeName); this.policyName = policyName; this.exceptionTypeName = exceptionTypeName; ExceptionHandlingConfigurationView exceptionHandlingConfigurationView = (ExceptionHandlingConfigurationView)CreateConfigurationView(); ExceptionHandlerDataCollection handlers = exceptionHandlingConfigurationView.GetExceptionHandlerDataCollection(policyName, exceptionTypeName); IExceptionHandler[] exceptionHandlers = new IExceptionHandler[handlers.Count]; int index = 0; foreach (ExceptionHandlerData handler in handlers) { exceptionHandlers[index++] = CreateExceptionHandler(policyName, exceptionTypeName, handler.Name); } return(exceptionHandlers); }