/// <summary>
 /// Configure file provider to let package loading errors be thrown.
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IPackageFileProviderOptions SetToThrowErrors(this IPackageFileProviderOptions options)
 => options.SetErrorHandler(throw_errors);
Пример #2
0
 /// <summary>
 /// Configure package file provider to log errors and then throw them.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="logger"></param>
 /// <returns></returns>
 public static IPackageFileProviderOptions SetToThrowAndLogErrors(this IPackageFileProviderOptions options, ILogger logger)
 => options.SetErrorHandler(e => {
     logger.LogError(e.LoadError, "Failed to open package file: {0}", options);
     return(false);
 });
 /// <summary>
 /// Configure package file provider to suppress package loading errors.
 /// When package loading fails and error is suppressed, then the file is treated as it is normal non-package file.
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IPackageFileProviderOptions SetToSuppressErrors(this IPackageFileProviderOptions options)
 => options.SetErrorHandler(suppress_errors);