Replace `InvalidDataException` with `InvalidOperationException`

This should be safe because we never filter caught exceptions by this type. I
assume these were all typos, this exception has something to do with Streams.
This commit is contained in:
YoshiRulz 2022-07-14 22:54:10 +10:00
parent e8c867979a
commit 90fe31529e
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 7 additions and 7 deletions

View File

@ -99,7 +99,7 @@ namespace BizHawk.Emulation.Common
return true;
}
/// <exception cref="InvalidDataException">
/// <exception cref="InvalidOperationException">
/// <paramref name="other"/> is not the same length as <see langword="this"/>, or
/// any value differs in size from the corresponding value in <paramref name="other"/>
/// </exception>
@ -107,7 +107,7 @@ namespace BizHawk.Emulation.Common
{
if (Count != other.Count)
{
throw new InvalidDataException("Dictionaries must have the same number of keys!");
throw new InvalidOperationException("Dictionaries must have the same number of keys!");
}
foreach (var (scope, fromData) in other)
@ -116,7 +116,7 @@ namespace BizHawk.Emulation.Common
if (fromData.Length != toData.Length)
{
throw new InvalidDataException("Memory regions must be the same size!");
throw new InvalidOperationException("Memory regions must be the same size!");
}
for (int i = 0; i < toData.Length; i++)
@ -177,7 +177,7 @@ namespace BizHawk.Emulation.Common
return SaveInternal(new MemoryStream(), false);
}
/// <exception cref="InvalidDataException">contents of <paramref name="s"/> do not begin with valid file header</exception>
/// <exception cref="InvalidOperationException">contents of <paramref name="s"/> do not begin with valid file header</exception>
public void Load(Stream s)
{
var br = new BinaryReader(s);
@ -186,7 +186,7 @@ namespace BizHawk.Emulation.Common
{
"BIZHAWK-CDL-1" => "PCE",
"BIZHAWK-CDL-2" => br.ReadString().TrimEnd(' '),
_ => throw new InvalidDataException("File is not a BizHawk CDL file!"),
_ => throw new InvalidOperationException("File is not a BizHawk CDL file!"),
};
int count = br.ReadInt32();
for (int i = 0; i < count; i++)

View File

@ -50,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
catch (Exception e) when (e is InvalidCastException || e is FormatException || e is OverflowException)
{
throw new InvalidDataException("Auto Mapper Properties were in a bad format!", e);
throw new InvalidOperationException("Auto Mapper Properties were in a bad format!", e);
}
}

View File

@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
private static int iNES2Wram(int i)
{
if (i == 0) return 0;
if (i == 15) throw new InvalidDataException();
if (i == 15) throw new InvalidOperationException();
return 1 << (i + 6);
}