Skip to content

Commit

Permalink
New default constructor for FileLoadExceptionContext
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkoshevoi committed Dec 9, 2021
1 parent a576913 commit a06b504
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public void ResolveFileProvider() { }
}
public partial class FileLoadExceptionContext
{
public FileLoadExceptionContext() { }
public System.Exception? Exception { get { throw null; } set { } }
public FileLoadExceptionContext(FileConfigurationProvider provider, System.Exception exception) { }
public System.Exception Exception { get { throw null; } set { } }
public bool Ignore { get { throw null; } set { } }
public Microsoft.Extensions.Configuration.FileConfigurationProvider? Provider { get { throw null; } set { } }
public Microsoft.Extensions.Configuration.FileConfigurationProvider Provider { get { throw null; } set { } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ private void HandleException(ExceptionDispatchInfo info)
bool ignoreException = false;
if (Source.OnLoadException != null)
{
var exceptionContext = new FileLoadExceptionContext
{
Provider = this,
Exception = info.SourceException
};
var exceptionContext = new FileLoadExceptionContext(this, info.SourceException);
Source.OnLoadException.Invoke(exceptionContext);
ignoreException = exceptionContext.Ignore;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ namespace Microsoft.Extensions.Configuration
/// </summary>
public class FileLoadExceptionContext
{
public FileLoadExceptionContext(FileConfigurationProvider provider, Exception exception)
{
Provider = provider;
Exception = exception;
}

/// <summary>
/// The <see cref="FileConfigurationProvider"/> that caused the exception.
/// </summary>
public FileConfigurationProvider? Provider { get; set; }
public FileConfigurationProvider Provider { get; set; }

/// <summary>
/// The exception that occurred in Load.
/// </summary>
public Exception? Exception { get; set; }
public Exception Exception { get; set; }

/// <summary>
/// If true, the exception will not be rethrown.
Expand Down

0 comments on commit a06b504

Please sign in to comment.