Dealt with exception in partition

This commit is contained in:
Anton Hvornum 2021-11-11 15:31:51 +00:00
parent 6f8b064ec5
commit 6d2126a597
1 changed files with 4 additions and 1 deletions

View File

@ -32,7 +32,10 @@ class Partition:
if mountpoint:
self.mount(mountpoint)
mount_information = get_mount_info(self.path)
try:
mount_information = get_mount_info(self.path)
except DiskError:
mount_information = {}
if self.mountpoint != mount_information.get('target', None) and mountpoint:
raise DiskError(f"{self} was given a mountpoint but the actual mountpoint differs: {mount_information.get('target', None)}")