Add NotImplementedError exceptions for unimpemented operations

This commit is contained in:
Eric Torres 2019-04-15 23:31:49 -07:00
parent 97c3f63f54
commit a42901cde6

View File

@ -88,6 +88,9 @@ class PackageManager:
:rtype: path-like object :rtype: path-like object
:raises NotImplementedError: if package list generation command is not present :raises NotImplementedError: if package list generation command is not present
""" """
if not self._pkglist_cmd:
raise NotImplementedError("Package list generation not implemented")
syslog.info("Creating a package list") syslog.info("Creating a package list")
try: try:
@ -114,7 +117,10 @@ class PackageManager:
:raises ValueError: if compress is not in packagemanager.VALID_DB_COMPRESS_MODES :raises ValueError: if compress is not in packagemanager.VALID_DB_COMPRESS_MODES
:raises NotImplementedError: if database path is not present :raises NotImplementedError: if database path is not present
""" """
if compress is not None and compress not in VALID_DB_COMPRESS_MODES: if not self._db_path:
raise NotImplementedError("Database archive generation not implemented")
if compress not in VALID_DB_COMPRESS_MODES:
raise ValueError(f"{compress} is not a valid compress mode") raise ValueError(f"{compress} is not a valid compress mode")
syslog.info("Creating a database archive") syslog.info("Creating a database archive")