Example #1
0
        /// <summary>
        /// Called when an exception occurs inside the library. It applies the exception handling policies.
        /// </summary>
        /// <param name="ex">The exception that has occurred.</param>
        /// <param name="exceptionType">Type of the exception.</param>
        private void OnExceptionOccurred(YAXException ex, YAXExceptionTypes exceptionType)
        {
            m_exceptionOccurredDuringMemberDeserialization = true;
            if (exceptionType == YAXExceptionTypes.Ignore)
            {
                return;
            }

            this.m_parsingErrors.AddException(ex, exceptionType);
            if ((this.m_exceptionPolicy == YAXExceptionHandlingPolicies.ThrowWarningsAndErrors) ||
                (this.m_exceptionPolicy == YAXExceptionHandlingPolicies.ThrowErrorsOnly && exceptionType == YAXExceptionTypes.Error))
            {
                throw ex;
            }
        }
 /// <summary>
 /// Adds an exception with the corresponding type.
 /// </summary>
 /// <param name="exception">The exception to add.</param>
 /// <param name="exceptionType">Type of the exception added.</param>
 public void AddException(YAXException exception, YAXExceptionTypes exceptionType)
 {
     this.listExceptions.Add(new KeyValuePair<YAXException, YAXExceptionTypes>(exception, exceptionType));
 }
Example #3
0
 /// <summary>
 ///     Adds an exception with the corresponding type.
 /// </summary>
 /// <param name="exception">The exception to add.</param>
 /// <param name="exceptionType">Type of the exception added.</param>
 public void AddException(YAXException exception, YAXExceptionTypes exceptionType)
 {
     listExceptions.Add(new KeyValuePair <YAXException, YAXExceptionTypes>(exception, exceptionType));
 }