Catch and print exceptions from device constructor.

This commit is contained in:
2019-11-02 01:15:49 +00:00
parent bdc55dd648
commit 438fa1c9a2
11 changed files with 754 additions and 565 deletions

View File

@@ -141,16 +141,16 @@ namespace DiscImageChef.Devices
if (StringHandlers.CToString(camDevice.SimName) == "ata")
throw new
InvalidOperationException(
DeviceException(
"Parallel ATA devices are not supported on FreeBSD due to upstream bug #224250.");
break;
}
default: throw new InvalidOperationException($"Platform {PlatformId} not yet supported.");
default: throw new DeviceException($"Platform {PlatformId} not yet supported.");
}
}
if (Error) throw new SystemException($"Error {LastError} opening device.");
if (Error) throw new DeviceException(LastError);
Type = DeviceType.Unknown;
ScsiType = PeripheralDeviceTypes.UnknownDevice;
@@ -158,7 +158,7 @@ namespace DiscImageChef.Devices
byte[] ataBuf;
byte[] inqBuf = null;
if (Error) throw new SystemException($"Error {LastError} trying device.");
if (Error) throw new DeviceException(LastError);
var scsiSense = true;