Преглед на файлове

Use ValueError in PropertyHolder.property_require()

Specifically do not use AssertionError, but also be consistent with
other value verification.
Marek Marczykowski-Górecki преди 5 години
родител
ревизия
c1c6dc2acd
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      qubes/__init__.py

+ 2 - 2
qubes/__init__.py

@@ -728,12 +728,12 @@ class PropertyHolder(qubes.events.Emitter):
         try:
             value = getattr(self, prop)
             if value is None and not allow_none:
-                raise AttributeError()
+                raise ValueError('Property {!r} cannot be None'.format(prop))
         except AttributeError:
             # pylint: disable=no-member
             msg = 'Required property {!r} not set on {!r}'.format(prop, self)
             if hard:
-                raise AssertionError(msg)
+                raise ValueError(msg)
             else:
                 # pylint: disable=no-member
                 self.log.fatal(msg)