Skip to content

Commit

Permalink
Switched to non-reserved Exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
DrizzlyOwl committed Aug 30, 2024
1 parent ddff33c commit e2bdd6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DfE.FindInformationAcademiesTrusts/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Azure.Identity;
Expand Down Expand Up @@ -275,13 +276,13 @@ private static void AddDataProtectionServices(WebApplicationBuilder builder)

if (string.IsNullOrWhiteSpace(kvProtectionPath))
{
throw new ApplicationException("DataProtection path is not set");
throw new ArgumentNullException("DataProtection path is not set");

Check warning on line 279 in DfE.FindInformationAcademiesTrusts/Program.cs

View workflow job for this annotation

GitHub Actions / Build .NET

The parameter name 'DataProtection path is not set' is not declared in the argument list. (https://rules.sonarsource.com/csharp/RSPEC-3928)
}

var kvProtectionPathDir = new DirectoryInfo(kvProtectionPath);
if (!kvProtectionPathDir.Exists || kvProtectionPathDir.Attributes.HasFlag(FileAttributes.ReadOnly))
{
throw new ApplicationException($"DataProtection path '{kvProtectionPath}' cannot be written to");
throw new ReadOnlyException($"DataProtection path '{kvProtectionPath}' cannot be written to");
}

dp.PersistKeysToFileSystem(kvProtectionPathDir);
Expand Down

0 comments on commit e2bdd6d

Please sign in to comment.