Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/chonkie/chunker/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ def chunk(self, text: str) -> list[Chunk]:
logger.debug(f"Using configured language: {self.language}")

try:
assert self.parser is not None, "Parser is not initialized."
if self.parser is None:
raise RuntimeError("Parser failed to initialize. Language detection or initialization failed.")
# Create the parsing tree for the current code
tree: Tree = self.parser.parse(original_text_bytes)
root_node: Node = tree.root_node
Expand Down
Loading