Module cruft.exceptions

Contains all custom exceptions raised by cruft

View Source
"""Contains all custom exceptions raised by cruft"""

class CruftError(Exception):

    """The base exception for any error originating from the cruft project"""

class UnableToFindCookiecutterTemplate(CruftError):

    """Raised when Cruft is unable to find a cookiecutter template"""

    def __init__(self, directory: str):

        super().__init__(self, f"Was unable to locate a Cookiecutter template in `{directory}` !")

        self.directory = directory

class NoCruftFound(CruftError):

    """Raised when no .cruft.json state is found in the current directory"""

    def __init__(self, directory: str):

        super().__init__(

            self, f"Was unable to locate a `.cruft.json` state file in `{directory}` !"

        )

        self.directory = directory

class CruftAlreadyPresent(CruftError):

    """Raised when there is an attempt to create a new .cruft.json file but one already exists"""

    def __init__(self, file_location: str):

        super().__init__(self, f"`.cruft.json` is already defined at `{file_location}` !")

        self.file_location = file_location

class InvalidCookiecutterRepository(CruftError):

    """Raised when an invalid cookiecutter repository is provided"""

    pass

Classes

CruftAlreadyPresent

class CruftAlreadyPresent(
    file_location: str
)

Raised when there is an attempt to create a new .cruft.json file but one already exists

View Source
class CruftAlreadyPresent(CruftError):

    """Raised when there is an attempt to create a new .cruft.json file but one already exists"""

    def __init__(self, file_location: str):

        super().__init__(self, f"`.cruft.json` is already defined at `{file_location}` !")

        self.file_location = file_location

Ancestors (in MRO)

  • cruft.exceptions.CruftError
  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.

CruftError

class CruftError(
    /,
    *args,
    **kwargs
)

The base exception for any error originating from the cruft project

View Source
class CruftError(Exception):

    """The base exception for any error originating from the cruft project"""

Ancestors (in MRO)

  • builtins.Exception
  • builtins.BaseException

Descendants

  • cruft.exceptions.UnableToFindCookiecutterTemplate
  • cruft.exceptions.NoCruftFound
  • cruft.exceptions.CruftAlreadyPresent
  • cruft.exceptions.InvalidCookiecutterRepository

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.

InvalidCookiecutterRepository

class InvalidCookiecutterRepository(
    /,
    *args,
    **kwargs
)

Raised when an invalid cookiecutter repository is provided

View Source
class InvalidCookiecutterRepository(CruftError):

    """Raised when an invalid cookiecutter repository is provided"""

    pass

Ancestors (in MRO)

  • cruft.exceptions.CruftError
  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.

NoCruftFound

class NoCruftFound(
    directory: str
)

Raised when no .cruft.json state is found in the current directory

View Source
class NoCruftFound(CruftError):

    """Raised when no .cruft.json state is found in the current directory"""

    def __init__(self, directory: str):

        super().__init__(

            self, f"Was unable to locate a `.cruft.json` state file in `{directory}` !"

        )

        self.directory = directory

Ancestors (in MRO)

  • cruft.exceptions.CruftError
  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.

UnableToFindCookiecutterTemplate

class UnableToFindCookiecutterTemplate(
    directory: str
)

Raised when Cruft is unable to find a cookiecutter template

View Source
class UnableToFindCookiecutterTemplate(CruftError):

    """Raised when Cruft is unable to find a cookiecutter template"""

    def __init__(self, directory: str):

        super().__init__(self, f"Was unable to locate a Cookiecutter template in `{directory}` !")

        self.directory = directory

Ancestors (in MRO)

  • cruft.exceptions.CruftError
  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

Exception.with_traceback(tb) -- set self.traceback to tb and return self.