Skip to content
Snippets Groups Projects
exceptions.py 556 B
Newer Older
# exceptions.py

import sys

class CustomException(Exception):
    """Base class for other exceptions"""
    def __init__(self, message):
        super().__init__(message)
        self.handle_exception(message)

    def handle_exception(self, message):
        print(f"Error: {message}")
        sys.exit(1)

class InvalidDeviceError(CustomException):
    """Exception raised when an improper fileset or path is given as the device"""
    pass

class ValueError(CustomException):
    """Overloaded exception to exit when improper value is given"""
    pass