Skip to content

Commit

Permalink
Improved exception message
Browse files Browse the repository at this point in the history
* Improved exception message when attempting to open a partial image file without an embedded descriptor
  • Loading branch information
LTRData committed May 24, 2024
1 parent a238a20 commit 7213d90
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Library/DiscUtils.Vmdk/DiskImageFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ internal DiskImageFile(FileLocator fileLocator, string file, FileAccess access)
fileStream = fileLocator.Open(file, FileMode.Open, fileAccess, fileShare);
LoadDescriptor(fileStream);

if (_descriptor is null)
{
throw new InvalidOperationException($"This VMDK image file does not contain an embedded descriptor");
}

// For monolithic disks, keep hold of the stream - we won't try to use the file name
// from the embedded descriptor because the file may have been renamed, making the
// descriptor out of date.
Expand Down

0 comments on commit 7213d90

Please sign in to comment.