Skip to content

Commit 9bc8345

Browse files
committed
Handle empty code block
1 parent d29b49a commit 9bc8345

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

interpreter/core/respond.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ def respond(interpreter):
262262
else:
263263
break
264264

265+
# Is there any code at all?
266+
if code.strip() == "":
267+
yield {
268+
"role": "computer",
269+
"type": "console",
270+
"format": "output",
271+
"content": "Code block was empty. Please try again, be sure to write code before executing.",
272+
}
273+
continue
274+
265275
# Yield a message, such that the user can stop code execution if they want to
266276
try:
267277
yield {

0 commit comments

Comments
 (0)