コード例 #1
0
        protected void ClearErrorContext()
        {
            if (_currentErrorContext == null)
            throw new InvalidOperationException("Could not clear error context. Error context is already null.");

              _currentErrorContext = null;
        }
コード例 #2
0
        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
ファイル: JsonContract.cs プロジェクト: eopeter/dmelibrary
 internal void InvokeOnError(object o, StreamingContext context, ErrorContext errorContext)
 {
     if (OnError != null)
     OnError.Invoke(o, new object[] { context, errorContext });
 }
コード例 #4
0
ファイル: ErrorEventArgs.cs プロジェクト: eopeter/dmelibrary
 /// <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;
 }