virtual_knitting_machine.knitting_machine_exceptions.Needle_Exception module

Module containing common machine knitting exceptions that involve needles and needle operations. This module provides exception classes for various needle-related critical errors including slider operations, loop transfers, alignment issues, and needle state violations that prevent successful knitting operations.

exception Needle_Exception(needle, message)[source]

Bases: Knitting_Machine_Exception

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

Parameters:
__init__(needle, message)[source]

Initialize a needle-specific exception.

Parameters:
  • needle (Needle) – The needle involved in the exception condition.

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

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.

exception Slider_Loop_Exception(needle)[source]

Bases: Needle_Exception

Exception for attempting to form loops on slider needles. This exception occurs when trying to create a new loop on a slider needle, which is not allowed as slider needles can only hold and transfer loops but cannot be used for loop formation operations.

Parameters:

needle (Needle)

__init__(needle)[source]

Initialize a slider loop formation exception.

Parameters:

needle (Needle) – The slider needle on which loop formation was attempted.

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.

exception Clear_Needle_Exception(needle)[source]

Bases: Needle_Exception

Exception for attempting to use needles when sliders are not clear. This exception occurs when trying to perform knitting operations while slider needles still hold loops, which must be cleared before standard knitting operations can proceed.

Parameters:

needle (Needle)

__init__(needle)[source]

Initialize a clear needle requirement exception.

Parameters:

needle (Needle) – The needle that cannot be used due to unclear sliders.

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.

exception Xfer_Dropped_Loop_Exception(needle)[source]

Bases: Needle_Exception

Exception for attempting to transfer dropped loops to target needles. This exception occurs when trying to transfer a loop that has already been dropped from the machine, which is not physically possible as the loop is no longer held by any needle.

Parameters:

needle (Needle)

__init__(needle)[source]

Initialize a transfer dropped loop exception.

Parameters:

needle (Needle) – The target needle where transfer of a dropped loop was attempted.

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.

exception Misaligned_Needle_Exception(start_needle, target_needle)[source]

Bases: Needle_Exception

Exception for operations attempted between needles that are not properly aligned at the current racking. This exception occurs when trying to perform transfer or other cross-bed operations between needles that are not aligned according to the machine’s current racking configuration.

Parameters:
__init__(start_needle, target_needle)[source]

Initialize a misaligned needle exception.

Parameters:
  • start_needle (Needle) – The starting needle for the attempted operation.

  • target_needle (Needle) – The target needle that is not aligned with the start needle.

property start_needle: Needle

Get the starting needle for the misaligned operation.

Returns:

Property used to have multiple names for start needle.

Return type:

Needle

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.