diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-03-18 20:30:27 +0100 |
---|---|---|
committer | lupoDharkael <izhe@hotmail.es> | 2024-03-21 10:29:57 +0100 |
commit | 049b7a5a2b13a69448937aba275ec2f35407b95e (patch) | |
tree | 8f96e1f6ef21d5de9366a2e89a79e56ce0f27917 /src/utils/hw_inventory.py | |
parent | 8741b2e2724fabb25465c06c3a4f881d9aa28d67 (diff) |
src: make exception messages more contextual and explicit
Provide more information in exception messages as those are the
source of the logging messages. Add information about paths, files
or configuration related to the operation associated to the
exception.
Diffstat (limited to 'src/utils/hw_inventory.py')
-rw-r--r-- | src/utils/hw_inventory.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utils/hw_inventory.py b/src/utils/hw_inventory.py index 23c8765..c534101 100644 --- a/src/utils/hw_inventory.py +++ b/src/utils/hw_inventory.py @@ -55,7 +55,7 @@ class HardwareInventory(): def add_element(self, elem): if elem.type not in HardwareType: - raise ValueError('Unsupported hardware type') + raise ValueError(f'Unsupported hardware type, received {elem.type}') if not elem.name: raise ValueError('Empty hardware element name') self.elements.append(elem) @@ -250,7 +250,7 @@ def legacy_hardware_element(element): represented as "vga=Foo" """ if type(element) is not HardwareElement: - raise TypeError('Invalid type') + raise TypeError('Invalid hardware element type') elif element.type is HardwareType.MULTIMEDIA: nemonic = 'mul' elif element.type is HardwareType.BOOTMODE: @@ -297,7 +297,7 @@ def get_hardware_inventory(): if type(j) is list: root = j[0] if type(root) is not dict: - raise ValueError('Unvalid lshw json output') + raise ValueError('Invalid lshw json output') inventory = HardwareInventory() _fill_computer_model(inventory, root) |