Skip to content

Commit 66e1883

Browse files
committed
boot-qemu.py: Use more specific exception class
New pylint warns: boot-qemu.py:401:12: W0719: Raising too general exception: Exception (broad-exception-raised) boot-qemu.py:431:16: W0719: Raising too general exception: Exception (broad-exception-raised) The type of exception really does not matter, as we do not expect this script to be called, so the exception will never be caught. However, it is easy to silence this by switching to a more specific exception. FileNotFoundError is descriptive so use this exception to silence the warning. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 1b837f3 commit 66e1883

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

boot-qemu.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ def get_efi_args(guest_arch):
398398

399399
for efi_img_location in efi_img_locations[guest_arch]:
400400
if efi_img_location is None:
401-
raise Exception(f"edk2 could not be found for {guest_arch}!")
401+
raise FileNotFoundError(
402+
f"edk2 could not be found for {guest_arch}!")
402403
efi_img = Path("/usr/share", efi_img_location)
403404
if efi_img.exists():
404405
break
@@ -428,7 +429,7 @@ def get_efi_args(guest_arch):
428429
]
429430
for efi_vars_location in efi_vars_locations:
430431
if efi_vars_location is None:
431-
raise Exception("OVMF_VARS.fd could not be found!")
432+
raise FileNotFoundError("OVMF_VARS.fd could not be found!")
432433
efi_vars = Path('/usr/share', efi_vars_location)
433434
if efi_vars.exists():
434435
break

0 commit comments

Comments
 (0)