Module portray.exceptions

All portray specific exception classes should be defined here

View Source
"""All portray specific exception classes should be defined here"""

class PortrayError(Exception):

    """Base class for all exceptions returned from portray"""

    pass

class NoProjectFound(PortrayError):

    """Thrown when portray is ran in a directory with no Python project"""

    def __init__(self, directory: str):

        super().__init__(

            self,

            f"No Python project found in the given directory: '{directory}'"

            + " See: https://timothycrosley.github.io/portray/TROUBLESHOOTING/#noprojectfound",

        )

        self.directory = directory

class DocumentationAlreadyExists(PortrayError):

    """Thrown when portray has been told to output documentation where it already exists"""

    def __init__(self, directory: str):

        super().__init__(

            self, f"Documentation already exists in '{directory}'. Use --overwrite to ignore"

        )

        self.directory = directory

Classes

DocumentationAlreadyExists

class DocumentationAlreadyExists(
    directory: str
)

Thrown when portray has been told to output documentation where it already exists

View Source
class DocumentationAlreadyExists(PortrayError):

    """Thrown when portray has been told to output documentation where it already exists"""

    def __init__(self, directory: str):

        super().__init__(

            self, f"Documentation already exists in '{directory}'. Use --overwrite to ignore"

        )

        self.directory = directory

Ancestors (in MRO)

  • portray.exceptions.PortrayError
  • 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.

NoProjectFound

class NoProjectFound(
    directory: str
)

Thrown when portray is ran in a directory with no Python project

View Source
class NoProjectFound(PortrayError):

    """Thrown when portray is ran in a directory with no Python project"""

    def __init__(self, directory: str):

        super().__init__(

            self,

            f"No Python project found in the given directory: '{directory}'"

            + " See: https://timothycrosley.github.io/portray/TROUBLESHOOTING/#noprojectfound",

        )

        self.directory = directory

Ancestors (in MRO)

  • portray.exceptions.PortrayError
  • 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.

PortrayError

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

Base class for all exceptions returned from portray

View Source
class PortrayError(Exception):

    """Base class for all exceptions returned from portray"""

    pass

Ancestors (in MRO)

  • builtins.Exception
  • builtins.BaseException

Descendants

  • portray.exceptions.NoProjectFound
  • portray.exceptions.DocumentationAlreadyExists

Class variables

args

Methods

with_traceback
def with_traceback(
    ...
)

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