lineapy.exceptions package

Submodules

lineapy.exceptions.create_frame module

Copied from https://naleraphael.github.io/blog/posts/devlog_create_a_builtin_frame_object/

lineapy.exceptions.create_frame.P_MEM_TYPE

alias of LP_c_ulong

lineapy.exceptions.create_frame.create_frame(code: code) frame[source]

Creates a new frame object from a code object.

lineapy.exceptions.db_exceptions module

exception lineapy.exceptions.db_exceptions.ArtifactSaveException[source]

lineapy.exceptions.excepthook module

lineapy.exceptions.excepthook.custom_excepthook(*args)[source]

CLI support. Sets an exception hook, so that if an exception is raised, if it’s a user exception, then the traceback will only be the inner cause, not the outer frames.

lineapy.exceptions.excepthook.set_custom_excepthook()[source]

To support CLI error reporting (or the repl, which we do not currently have).

lineapy.exceptions.excepthook.transform_except_hook_args(args: Tuple[Type[Exception], Exception, Optional[TracebackType]], *changes: Union[RemoveFrames, AddFrame, RemoveFramesWhile]) Tuple[Type[Exception], Exception, Optional[TracebackType]][source]

Used by both CLI and Jupyter to pull out the cause from a user exception and also apply the changes to the frames if it’s a UserException, which is a custom exception that WE created.

changes is for Jupyter notebook support. They were discovered through trial and error with different type of executions, as seen in executor.py.

If the error is from lineapy, we keep the original frames.

lineapy.exceptions.flag module

lineapy.exceptions.l_import_error module

exception lineapy.exceptions.l_import_error.LImportError[source]

lineapy.exceptions.user_exception module

class lineapy.exceptions.user_exception.AddFrame(filename: str, lineno: int)[source]

Add a dummy frame with a filename and line number.

class lineapy.exceptions.user_exception.RemoveFrames(n: int)[source]

Remove n frames from the top

class lineapy.exceptions.user_exception.RemoveFramesWhile(predicate: Callable[[frame], bool])[source]

Remove frames while the predicate is true

exception lineapy.exceptions.user_exception.UserException(cause: Exception, *changes: Union[RemoveFrames, AddFrame, RemoveFramesWhile])[source]

Create a traceback based on an original traceback with a number of changes applied to it.

lineapy.exceptions.user_exception.apply_changes(exc: Exception, changes: Iterable[Union[RemoveFrames, AddFrame, RemoveFramesWhile]]) None[source]

Update an exception’s traceback with the changes provided.

Module contents