virtual_knitting_machine.knitting_machine_exceptions.Yarn_Carrier_Error_State module

Collection of exceptions for error states that involve yarn carriers and yarn management operations. This module provides comprehensive exception classes for various yarn carrier issues including hook conflicts, inactive carrier usage, yarn cutting errors, and carrier system modifications that would cause critical operational failures.

exception Yarn_Carrier_Error(carrier_id, message, violation=Violation.YARN_CARRIER_VIOLATION)[source]

Bases: Knitting_Machine_Error

Base class for exceptions related to yarn carrier operations and states. This class provides a foundation for all yarn carrier-specific exceptions and includes the carrier ID reference for detailed error reporting and debugging of carrier-related operational failures.

__init__(carrier_id, message, violation=Violation.YARN_CARRIER_VIOLATION)[source]

Initialize a yarn carrier-specific exception.

Parameters:
  • carrier_id (int | Yarn_Carrier) – The carrier ID or carrier object involved in the exception condition.

  • message (str) – The descriptive error message about the carrier state or operation failure.

  • violation (Violation, optional) – The type of violation associated with this error. Defaults to Violation.YARN_CARRIER_VIOLATION.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

violation: Violation
exception Hooked_Carrier_Error(carrier_id)[source]

Bases: Yarn_Carrier_Error

Exception for attempting hook operations on carriers that are already on the yarn inserting hook. This exception occurs when trying to perform an operation that requires the carrier to not be on the insertion hook, such as an outhook operation, when the carrier is currently connected to the hook.

__init__(carrier_id)[source]

Initialize a hooked carrier operation exception.

Parameters:

carrier_id (int | Yarn_Carrier) – The carrier that is already on the yarn inserting hook.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

carrier_id: Yarn_Carrier_State | int
violation: Violation
exception Blocked_by_Yarn_Inserting_Hook_Error(hooked_carrier_id, needle)[source]

Bases: Yarn_Carrier_Error

__init__(hooked_carrier_id, needle)[source]

Initialize a yarn carrier-specific exception.

Parameters:
  • carrier_id (int | Yarn_Carrier) – The carrier ID or carrier object involved in the exception condition.

  • message (str) – The descriptive error message about the carrier state or operation failure.

  • violation (Violation, optional) – The type of violation associated with this error. Defaults to Violation.YARN_CARRIER_VIOLATION.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

carrier_id: Yarn_Carrier_State | int
violation: Violation
exception Inserting_Hook_In_Use_Error(carrier_id)[source]

Bases: Yarn_Carrier_Error, ValueError

Exception for attempting to use the yarn inserting hook when it is already occupied by another carrier. This exception occurs when trying to perform hook operations while the insertion hook is already in use by a different carrier, preventing conflicts in hook operations.

__init__(carrier_id)[source]

Initialize an inserting hook in use exception.

Parameters:

carrier_id (int | Yarn_Carrier) – The carrier that attempted to use the already occupied insertion hook.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

carrier_id: Yarn_Carrier_State | int
violation: Violation
exception Use_Inactive_Carrier_Error(carrier_id)[source]

Bases: Yarn_Carrier_Error

Exception for attempting to use carriers that are not in active state. This exception occurs when trying to perform knitting operations with a carrier that is not active (still on grippers or otherwise unavailable), which would result in no yarn being fed to the needles.

__init__(carrier_id)[source]

Initialize an inactive carrier usage exception.

Parameters:

carrier_id (int | Yarn_Carrier) – The inactive carrier that was attempted to be used.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

carrier_id: Yarn_Carrier_State | int
violation: Violation