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_Error(needle, message, violation=Violation.Machine_State_Violation)[source]

Bases: Knitting_Machine_Error

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.

__init__(needle, message, violation=Violation.Machine_State_Violation)[source]

Initialize a needle-specific exception.

Parameters:
  • needle (Needle_Specification) – 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.

violation: Violation
exception Slider_Loop_Error(needle)[source]

Bases: Needle_Error

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.

__init__(needle)[source]

Initialize a slider loop formation exception.

Parameters:

needle (Needle_Specification) – 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.

needle: Needle_Specification
violation: Violation