Example #1
0
        /// <summary> Add a new warning which occurred during parsing to this MARC record object </summary>
        /// <param name="warning"> Warning object to add to the list </param>
        public void AddWarning(ParsingWarning warning)
        {
            // Ensure the list is built
            if (_warnings == null)
            {
                _warnings = new List <ParsingWarning>();
            }

            // If no other warning of the same type exists, add this
            if (!_warnings.Contains(warning))
            {
                _warnings.Add(warning);
            }
        }
Example #2
0
 /// <summary>
 /// NB: this will always conver the exception to a LiftFormatException, if it isn't already
 /// </summary>
 /// <param name="error"></param>
 private void NotifyFormatError(Exception error)
 {
     if (ParsingWarning != null)
     {
         //it's important to pass this on as a format error, which the client should be expecting
         //to report without crashing.
         if (!(error is LiftFormatException))
         {
             error = new LiftFormatException(error.Message, error);
         }
         ErrorArgs e = new ErrorArgs();
         e.Exception = error;
         ParsingWarning.Invoke(this, e);
     }
 }
Example #3
0
        /// <summary> Add a new warning which occurred during parsing to this MARC record object </summary>
        /// <param name="warningType"> Type of this warning </param>
        public void AddWarning(MarcRecordParsingWarningTypeEnum warningType)
        {
            // Ensure the list is built
            if (_warnings == null)
            {
                _warnings = new List <ParsingWarning>();
            }

            // Build this warning object
            var warning = new ParsingWarning(warningType);

            // If no other warning of the same type exists, add this
            if (!_warnings.Contains(warning))
            {
                _warnings.Add(warning);
            }
        }