knit_script.knit_script_exceptions.python_style_exceptions module

KnitScript exceptions that mirror Python’s built-in exception types.

This module provides KnitScript-specific exception classes that mirror Python’s built-in exception types while adding location information from the parse tree.

These exceptions maintain compatibility with Python’s exception hierarchy while providing enhanced error reporting specific to knit script programs.

exception Knit_Script_TypeError(message, ks_element)[source]

Bases: Knit_Script_Located_Exception, TypeError

KnitScript-specific TypeError with location information.

This exception class combines the standard Python TypeError with KnitScript location information, providing enhanced error reporting for type-related errors that occur during knit script execution. It maintains compatibility with Python’s TypeError while adding parse tree location context.

Parameters:
__init__(message, ks_element)[source]

Initialize the Knit_Script_TypeError.

Parameters:
  • message (str) – The error message describing the type error.

  • ks_element (KS_Element) – The KS_Element from the parse tree that caused the exception.

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.

error_location: Location
exception Knit_Script_AttributeError(message, ks_element)[source]

Bases: Knit_Script_Located_Exception, AttributeError

KnitScript-specific AttributeError with location information.

This exception class combines the standard Python AttributeError with KnitScript location information, providing enhanced error reporting for attribute access errors that occur during knit script execution. It maintains compatibility with Python’s AttributeError while adding parse tree location context.

Parameters:
__init__(message, ks_element)[source]

Initialize the Knit_Script_AttributeError.

Parameters:
  • message (str) – The error message describing the attribute error.

  • ks_element (KS_Element) – The KS_Element from the parse tree that caused the exception.

add_note()

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

args
name

attribute name

obj

object

with_traceback()

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

error_location: Location
exception Knit_Script_NameError(message, ks_element)[source]

Bases: Knit_Script_Located_Exception, NameError

KnitScript-specific NameError with location information.

This exception class combines the standard Python NameError with KnitScript location information, providing enhanced error reporting for name resolution errors that occur during knit script execution. It maintains compatibility with Python’s NameError while adding parse tree location context.

Parameters:
__init__(message, ks_element)[source]

Initialize the Knit_Script_NameError.

Parameters:
  • message (str) – The error message describing the name resolution error.

  • ks_element (KS_Element) – The KS_Element from the parse tree that caused the exception.

add_note()

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

args
name
with_traceback()

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

error_location: Location
exception Knit_Script_IndexError(message, ks_element)[source]

Bases: Knit_Script_Located_Exception, IndexError

KnitScript-specific IndexError with location information.

This exception class combines the standard Python IndexError with KnitScript location information, providing enhanced error reporting for indexing errors that occur during knit script execution. It maintains compatibility with Python’s IndexError while adding parse tree location context.

Parameters:
__init__(message, ks_element)[source]

Initialize the Knit_Script_IndexError.

Parameters:
  • message (str) – The error message describing the indexing error.

  • ks_element (KS_Element) – The KS_Element from the parse tree that caused the exception.

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.

error_location: Location
exception Knit_Script_KeyError(message, ks_element)[source]

Bases: Knit_Script_Located_Exception, KeyError

KnitScript-specific KeyError with location information.

This exception class combines the standard Python KeyError with KnitScript location information, providing enhanced error reporting for key access errors that occur during knit script execution. It maintains compatibility with Python’s KeyError while adding parse tree location context.

Parameters:
__init__(message, ks_element)[source]

Initialize the Knit_Script_KeyError.

Parameters:
  • message (str) – The error message describing the key access error.

  • ks_element (KS_Element) – The KS_Element from the parse tree that caused the exception.

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.

error_location: Location
exception Knit_Script_ImportError(message, ks_element)[source]

Bases: Knit_Script_Located_Exception, ImportError

KnitScript-specific ImportError with location information.

This exception class combines the standard Python ImportError with KnitScript location information, providing enhanced error reporting for module import errors that occur during knit script execution. It maintains compatibility with Python’s ImportError while adding parse tree location context.

Parameters:
__init__(message, ks_element)[source]

Initialize the Knit_Script_ImportError.

Parameters:
  • message (str) – The error message describing the import error.

  • ks_element (KS_Element) – The KS_Element from the parse tree that caused the exception.

add_note()

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

args
msg

exception message

name

module name

path

module path

with_traceback()

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

error_location: Location
exception Knit_Script_ValueError(message, ks_element)[source]

Bases: Knit_Script_Located_Exception, ValueError

KnitScript-specific ValueError with location information.

This exception class combines the standard Python ValueError with KnitScript location information, providing enhanced error reporting for value-related errors that occur during knit script execution. It maintains compatibility with Python’s ValueError while adding parse tree location context.

Parameters:
__init__(message, ks_element)[source]

Initialize the Knit_Script_ValueError.

Parameters:
  • message (str) – The error message describing the value error.

  • ks_element (KS_Element) – The KS_Element from the parse tree that caused the exception.

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.

error_location: Location