API reference
python:astx:astx.ExceptionHandlerStmt
class ExceptionHandlerStmt
ExceptionHandlerStmt(body: Block[AST], handlers: Iterable[CatchHandlerStmt] | ASTNodes[CatchHandlerStmt], finally_handler: Optional[FinallyHandlerStmt] = None, parent: Optional[ASTNodes] = None, loc: SourceLocation = NO_SOURCE_LOCATION, *, else_body: Optional[Block[AST]] = None)
Source: packages/astx/src/astx/exceptions.py:212
Declared as: python:astx:astx.exceptions.ExceptionHandlerStmt
AST class for try statements.
Preserve protected, handler, normal-completion, and finalization suites as separate children. An absent else suite differs from an empty block. Clause validity and execution support belong to semantic analysis.
Attributes
-
kind — Type: ASTKind
-
body — Type: Block[AST]
-
handlers — Type: ASTNodes[CatchHandlerStmt]
-
finally_handler — Type: Optional[FinallyHandlerStmt]
-
else_body — Type: Optional[Block[AST]]
Methods
-
__init__ — Initialize the instance.
-
__str__ — Return a string that represents the object.
-
get_struct — Return the AST structure of the object.