Add runtime error for improperly created artifacts

This commit is contained in:
Matt Nadareski
2024-08-23 17:07:24 -04:00
parent 9dddf1c9b6
commit 66fc36fe3c
2 changed files with 9 additions and 2 deletions

View File

@@ -50,6 +50,7 @@
- Add unused passable func to OutputFile
- Pass in new func for OutputFile
- Use new func in Redumper
- Add runtime error for improperly created artifacts
### 3.2.1 (2024-08-05)

View File

@@ -142,8 +142,6 @@ namespace MPF.Processors
/// </summary>
private readonly Func<string, bool>? _existsFunc;
// TODO: Add validation that a key exists if the artifact flag is present
/// <summary>
/// Create an OutputFile with a single filename
/// </summary>
@@ -169,6 +167,10 @@ namespace MPF.Processors
ArtifactKey = null;
_flags = flags;
_existsFunc = existsFunc;
// Ensure artifacts have a key
if (IsArtifact && string.IsNullOrEmpty(ArtifactKey))
throw new InvalidDataException($"{flags} should not contain the Artifact or Binary flag");
}
/// <summary>
@@ -180,6 +182,10 @@ namespace MPF.Processors
ArtifactKey = artifactKey;
_flags = flags;
_existsFunc = existsFunc;
// Ensure artifacts have a key
if (IsArtifact && string.IsNullOrEmpty(ArtifactKey))
throw new InvalidDataException($"{flags} should not contain the Artifact or Binary flag");
}
/// <summary>