Skip to content

Exceptions

PacklayerError

Bases: Exception

Base exception for all packlayer errors.

Source code in packlayer/domain/exceptions.py
class PacklayerError(Exception):
    """Base exception for all packlayer errors."""

ResolveError

Bases: PacklayerError

Failed to resolve a modpack.

Source code in packlayer/domain/exceptions.py
class ResolveError(PacklayerError):
    """Failed to resolve a modpack."""

LocalFileNotFound

Bases: ResolveError

Source code in packlayer/domain/exceptions.py
class LocalFileNotFound(ResolveError):
    def __init__(self, path: str) -> None:
        super().__init__(f"file not found: {path}")

InvalidMrpack

Bases: ResolveError

Source code in packlayer/domain/exceptions.py
class InvalidMrpack(ResolveError):
    def __init__(self, reason: str) -> None:
        super().__init__(f"invalid .mrpack: {reason}")

SlugNotFound

Bases: ResolveError

Source code in packlayer/domain/exceptions.py
class SlugNotFound(ResolveError):
    def __init__(self, slug: str) -> None:
        super().__init__(f"modpack not found on Modrinth: {slug!r}")

NoVersionFound

Bases: ResolveError

Source code in packlayer/domain/exceptions.py
class NoVersionFound(ResolveError):
    def __init__(self, slug: str, minecraft_version: str | None) -> None:
        mc = f" for Minecraft {minecraft_version}" if minecraft_version else ""
        super().__init__(f"no .mrpack version found for {slug!r}{mc}")

NoResolverFound

Bases: ResolveError

Source code in packlayer/domain/exceptions.py
class NoResolverFound(ResolveError):
    def __init__(self, source: str) -> None:
        super().__init__(f"no resolver can handle source: {source!r}")

DownloadError

Bases: PacklayerError

Failed to download a file.

Source code in packlayer/domain/exceptions.py
class DownloadError(PacklayerError):
    """Failed to download a file."""

HashMismatch

Bases: DownloadError

Source code in packlayer/domain/exceptions.py
class HashMismatch(DownloadError):
    def __init__(self, filename: str) -> None:
        super().__init__(f"sha512 mismatch — file may be corrupted: {filename}")

NetworkError

Bases: PacklayerError

Source code in packlayer/domain/exceptions.py
class NetworkError(PacklayerError):
    def __init__(self, reason: str) -> None:
        super().__init__(f"network error: {reason}")