Exceptions
Module: terminaltexteffects.utils.exceptions
Every TTE exception derives from TerminalTextEffectsError, so catch it to handle any engine error. The specific
exceptions are importable from terminaltexteffects.utils.exceptions and are grouped below by the module that defines
them. Import the base class from terminaltexteffects.utils.exceptions.base_terminaltexteffects_exception.
Base Exception
Animation Exceptions
Custom exceptions for handling errors related to animations in the terminaltexteffects package.
Classes:
| Name | Description |
|---|---|
FrameDurationError |
Raised when a frame is added to a Scene with an invalid duration. |
ActivateEmptySceneError |
Raised when a Scene without any frames is activated. |
AnimationSceneError |
Generic Scene/animation error with a provided message. |
DuplicateSceneIDError |
Raised when a Scene is initialized with an existing ID. |
ActivateEmptySceneError
Bases: TerminalTextEffectsError
Raised when a Scene is without any frames is activated.
A Scene must have at least one frame to be activated.
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
__init__(scene)
Initialize an ActivateEmptySceneError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scene
|
Scene
|
The Scene that was activated. |
required |
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
AnimationSceneError
Bases: TerminalTextEffectsError
Generic Scene/animation error with a provided message.
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
__init__(message)
Initialize an AnimationSceneError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The message to display. |
required |
DuplicateSceneIDError
Bases: TerminalTextEffectsError
Raised when a Scene is initialized with a duplicate ID.
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
__init__(scene_id)
Initialize a DuplicateSceneIDError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scene_id
|
str
|
The ID already used by a Scene in the Animation. |
required |
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
FrameDurationError
Bases: TerminalTextEffectsError
Raised when a frame is added to a Scene with an invalid duration.
A frame duration must be a positive integer. This error is raised when a frame is added to a Scene with a duration that is not a positive integer.
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
__init__(duration)
Initialize a FrameDurationError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
int
|
The duration provided to the frame. |
required |
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
SceneNotFoundError
Bases: TerminalTextEffectsError
Raised when query_scene is called with a scene_id that does not exist.
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
__init__(scene_id)
Initialize a SceneNotFoundError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scene_id
|
str
|
The scene_id that was not found. |
required |
Source code in terminaltexteffects/utils/exceptions/animation_exceptions.py
Character Exceptions
Custom exceptions for handling errors related to EffectCharacters in the terminaltexteffects package.
DuplicateEventRegistrationError
Bases: TerminalTextEffectsError
Raised when attempting to register a duplicate event-action combination.
This error is raised when trying to register the same event-caller-action-target combination that has already been registered. Each unique combination can only be registered once to prevent duplicate event handling.
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
__init__(event, caller, action, target)
Initialize a DuplicateEventRegistrationError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Event
|
The event that was already registered. |
required |
caller
|
Scene | Waypoint | Path | Mount
|
The caller object that was already registered. |
required |
action
|
Action
|
The action that was already registered. |
required |
target
|
Scene | Path | Mount | int | Coord | Callback | str | None
|
The target that was already registered. |
required |
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
EventRegistrationCallerError
Bases: TerminalTextEffectsError
Raised when an event is registered with an invalid event -> caller relationship.
Each event can only be registered with a related caller type. This error is raised when an event is registered with a caller that is not of the required type. For example, a Scene will never trigger a Path related event, and vice versa.
The following are the valid caller types for each event:
Event -> Caller
- SEGMENT_* -> Path
- PATH_* -> Path
- SCENE_* -> Scene
- MOUNT_* -> Mount
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
__init__(event, caller, required)
Initialize an EventRegistrationCallerError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Event
|
The event that was registered. |
required |
caller
|
Scene | Waypoint | Path | Mount | str
|
The object provided to trigger the event. |
required |
required
|
Scene | Waypoint | Path | Mount
|
The valid caller types for the event. |
required |
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
EventRegistrationTargetError
Bases: TerminalTextEffectsError
Raised when an event is registered with an invalid action -> target relationship.
Each event action can only be registered with a related target type. This error is raised when an event action is registered with a target that is not of the required type. For example, an ACTIVATE_SCENE action will can not activate on a Path target.
The following are the valid target types for each action:
Action -> Target
- *_SCENE -> Scene
- *_PATH -> Path
- SET_LAYER -> Int
- SET_COORDINATE -> Coord
- CALLBACK -> EventHandler.Callback
- RESET_APPEARANCE -> None
- MOUNT, UNMOUNT -> Mount
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
__init__(action, target, required)
Initialize an EventRegistrationTargetError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
Action
|
The action that was registered. |
required |
target
|
Scene | Path | Mount | int | Coord | Callback | str | None
|
The target provided to the action. |
required |
required
|
type[Scene | Path | Mount | int | Coord | Callback | str | None]
|
The valid target types. |
required |
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
InvalidSymbolError
Bases: TerminalTextEffectsError
Raised when a character or visual symbol violates the display-cell contract.
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
__init__(symbol)
Initialize an InvalidSymbolError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Invalid symbol supplied by the caller or input stream. |
required |
Source code in terminaltexteffects/utils/exceptions/base_character_exceptions.py
Motion Exceptions
Custom exceptions for handling errors related to motion in the terminaltexteffects package.
ActivateEmptyPathError
Bases: TerminalTextEffectsError
Raised when attempting to activate an empty Path.
An ActivateEmptyPathError is raised when attempting to activate a Path that has no Waypoints.
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
__init__(path_id)
Initialize an ActivateEmptyPathError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_id
|
str
|
The ID of the Path that is empty. |
required |
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
DuplicatePathIDError
Bases: TerminalTextEffectsError
Raised when a Path is initialized with a duplicate ID.
A DuplicatePathIDError is raised when a Path is initialized with an ID that has already been used.
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
__init__(path_id)
Initialize a DuplicatePathIDError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_id
|
str
|
The ID provided to the Path. |
required |
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
DuplicateWaypointIDError
Bases: TerminalTextEffectsError
Raised when a Waypoint is initialized with a duplicate ID.
A DuplicateWaypointIDError is raised when a Waypoint is initialized with an ID that has already been used in the Path.
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
__init__(waypoint_id)
Initialize a DuplicateWaypointIDError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waypoint_id
|
str
|
The ID provided to the Waypoint. |
required |
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
PathInvalidSpeedError
Bases: TerminalTextEffectsError
Raised when a Path is initialized with an invalid speed.
A Path must be initialized with a speed that is a positive float. This error is raised when a Path is initialized with a speed that is not a positive float.
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
__init__(speed)
Initialize a PathInvalidSpeedError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
speed
|
float
|
The speed provided to the Path. |
required |
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
PathNotFoundError
Bases: TerminalTextEffectsError
Raised when a Path is not found.
A PathNotFoundError is raised when a Path with the given ID is not found.
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
__init__(path_id)
Initialize a PathNotFoundError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_id
|
str
|
The path ID queried. |
required |
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
WaypointNotFoundError
Bases: TerminalTextEffectsError
Raised when a Waypoint is not found in a Path.
A WaypointNotFoundError is raised when a Waypoint with the given ID is not found in a Path.
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
__init__(waypoint_id)
Initialize a WaypointNotFoundError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waypoint_id
|
str
|
The waypoint ID queried. |
required |
Source code in terminaltexteffects/utils/exceptions/motion_exceptions.py
Terminal Exceptions
Custom exceptions for handling errors related to the Terminal in the terminaltexteffects package.
EmptyInputError
Bases: TerminalTextEffectsError
Raised when an effect has no visible input characters to render.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__()
Initialize an EmptyInputError.
InvalidCharacterCoordinateError
Bases: TerminalTextEffectsError
Raised when an added character is given an invalid coordinate.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(coord)
Initialize an InvalidCharacterCoordinateError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coord
|
Coord | object
|
Coordinate supplied to the terminal. |
required |
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
InvalidCharacterError
Bases: TerminalTextEffectsError
Raised when a character is not owned by the receiving terminal.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(character)
Initialize an InvalidCharacterError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
character
|
object
|
Character supplied to the terminal. |
required |
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
InvalidCharacterGroupError
Bases: TerminalTextEffectsError
Raised when an invalid character group is provided to a Terminal method.
An InvalidCharacterGroupError is raised when a character group is provided to a Terminal method that is not a valid character group.
Ref CharacterGroup.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(character_group)
Initialize an InvalidCharacterGroupError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
character_group
|
CharacterGroup | str
|
The character group provided to the Terminal method. |
required |
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
InvalidCharacterOrderError
Bases: TerminalTextEffectsError
Raised when a terminal receives an invalid character order.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(character_order)
Store the invalid character_order and describe the expected type.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
InvalidCharacterSortError
Bases: TerminalTextEffectsError
Raised when an invalid character sort is provided to a Terminal method.
An InvalidCharacterSortError is raised when a character sort is provided to a Terminal method that is not a valid character sort.
Ref CharacterSort.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(character_sort)
Initialize an InvalidCharacterSortError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
character_sort
|
CharacterSort | str
|
The character sort provided to the Terminal method. |
required |
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
InvalidCharacterVisibilityError
Bases: TerminalTextEffectsError
Raised when a character visibility value is not a boolean.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(visibility)
Initialize an InvalidCharacterVisibilityError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visibility
|
object
|
Visibility value supplied to the terminal. |
required |
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
InvalidColorSortError
Bases: TerminalTextEffectsError
Raised when an invalid color sort is provided to a Terminal method.
An InvalidColorSortError is raised when a color sort is provided to a Terminal method that is not a valid color sort.
Ref ColorSort.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(color_sort)
Initialize an InvalidColorSortError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color_sort
|
ColorSort
|
The color sort provided to the Terminal method. |
required |
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
TerminalOutputActiveError
Bases: TerminalTextEffectsError
Raised when a second terminal attempts to use the global saved cursor position.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__()
Initialize a TerminalOutputActiveError.
TerminalOutputNotPreparedError
Bases: TerminalTextEffectsError
Raised when cursor-relative output is attempted before canvas preparation.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(operation)
Initialize a TerminalOutputNotPreparedError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Output operation attempted before preparation. |
required |
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
UnsupportedAnsiSequenceError
Bases: TerminalTextEffectsError
Raised when terminal input contains ANSI/control sequences TTE does not support.
Source code in terminaltexteffects/utils/exceptions/terminal_exceptions.py
__init__(sequence)
Initialize an UnsupportedAnsiSequenceError.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence
|
str
|
The unsupported ANSI/control sequence found in the input. |
required |