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:189
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 — Kind of value or operation.; Type: ASTKind
-
body — Statements forming the body.; Type: Block[AST]
-
handlers — Handlers.; Type: ASTNodes[CatchHandlerStmt]
-
finally_handler — Finally handler.; Type: Optional[FinallyHandlerStmt]
-
else_body — Else body.; Type: Optional[Block[AST]]
-
loc — Type: SourceLocation
-
comment — Type: str
-
parent — Type: Optional[ASTNodes]
-
ref — Type: str
Methods
-
__init__ — Initialize the instance.
-
__str__ — Return a string that represents the object.
-
get_struct — Return the AST structure of the object.