This should actually be a different exception type

This commit is contained in:
Matt Nadareski
2025-09-16 22:08:50 -04:00
parent ca7c88cef6
commit 1950f23cf4

View File

@@ -92,7 +92,6 @@ namespace SabreTools.Serialization.Wrappers
/// <param name="data">Underlying data for the wrapper</param>
/// <param name="offset">Offset into the data to use as the window start</param>
/// <param name="length">Length of the window into the data</param>
/// <exception cref="ArgumentOutOfRangeException"></exception>
protected WrapperBase(byte[] data, int offset, int length)
{
if (offset < 0 || offset >= data.Length)
@@ -133,11 +132,10 @@ namespace SabreTools.Serialization.Wrappers
/// <param name="data">Underlying data for the wrapper</param>
/// <param name="offset">Offset into the data to use as the window start</param>
/// <param name="length">Length of the window into the data</param>
/// <exception cref="ArgumentOutOfRangeException"></exception>
protected WrapperBase(Stream data, long offset, long length)
{
if (!data.CanSeek || !data.CanRead)
throw new ArgumentOutOfRangeException(nameof(data));
throw new InvalidDataException(nameof(data));
if (offset < 0 || offset >= data.Length)
throw new ArgumentOutOfRangeException(nameof(offset));
if (length < 0 || offset + length >= data.Length)