protected void ClearErrorContext()
        {
            if (_currentErrorContext == null)
            throw new InvalidOperationException("Could not clear error context. Error context is already null.");

              _currentErrorContext = null;
        }
        protected ErrorContext GetErrorContext(object currentObject, object member, Exception error)
        {
            if (_currentErrorContext == null)
            _currentErrorContext = new ErrorContext(currentObject, member, error);

              if (_currentErrorContext.Error != error)
            throw new InvalidOperationException("Current error context error is different to requested error.");

              return _currentErrorContext;
        }
示例#3
0
 internal void InvokeOnError(object o, StreamingContext context, ErrorContext errorContext)
 {
     if (OnError != null)
     OnError.Invoke(o, new object[] { context, errorContext });
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ErrorEventArgs"/> class.
 /// </summary>
 /// <param name="currentObject">The current object.</param>
 /// <param name="errorContext">The error context.</param>
 public ErrorEventArgs(object currentObject, ErrorContext errorContext)
 {
     CurrentObject = currentObject;
       ErrorContext = errorContext;
 }