Source code for babase._error

# Released under the MIT License. See LICENSE for details.
#
"""Error related functionality."""

from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from typing import Any


[docs] class ContextError(Exception): """Raised when a call is made in an invalid context. Examples of this include calling UI functions within an activity context or calling scene manipulation functions outside of a scene context. """
[docs] class NotFoundError(Exception): """Raised when a referenced object does not exist."""
[docs] class PlayerNotFoundError(NotFoundError): """Raised when an expected player does not exist."""
[docs] class SessionPlayerNotFoundError(NotFoundError): """Exception raised when an expected session-player does not exist."""
[docs] class TeamNotFoundError(NotFoundError): """Raised when an expected team does not exist."""
[docs] class MapNotFoundError(NotFoundError): """Raised when an expected map does not exist."""
[docs] class DelegateNotFoundError(NotFoundError): """Raised when an expected delegate object does not exist."""
[docs] class SessionTeamNotFoundError(NotFoundError): """Raised when an expected session-team does not exist."""
[docs] class NodeNotFoundError(NotFoundError): """Raised when an expected node does not exist."""
[docs] class ActorNotFoundError(NotFoundError): """Raised when an expected actor does not exist."""
[docs] class ActivityNotFoundError(NotFoundError): """Raised when an expected activity does not exist."""
[docs] class SessionNotFoundError(NotFoundError): """Raised when an expected session does not exist."""
[docs] class InputDeviceNotFoundError(NotFoundError): """Raised when an expected input-device does not exist."""
[docs] class WidgetNotFoundError(NotFoundError): """Raised when an expected widget does not exist."""
# Docs-generation hack; import some stuff that we likely only forward-declared # in our actual source code so that docs tools can find it. from typing import (Coroutine, Any, Literal, Callable, Generator, Awaitable, Sequence, Self) import asyncio from concurrent.futures import Future from pathlib import Path from enum import Enum