Skip to content

Commit 4fc3dda

Browse files
for safety
1 parent c3f1b1f commit 4fc3dda

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

codeflash/lsp/beta.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,21 @@ def perform_function_optimization(
431431
server.optimizer.current_worktree, relative_file_paths, function_to_optimize_qualified_name
432432
)
433433

434+
if not patch_path:
435+
return {
436+
"functionName": params.functionName,
437+
"status": "error",
438+
"message": "Failed to create a patch for optimization",
439+
}
440+
434441
server.show_message_log(f"Optimization completed for {params.functionName} with {speedup:.2f}x speedup", "Info")
435442

436443
return {
437444
"functionName": params.functionName,
438445
"status": "success",
439446
"message": "Optimization completed successfully",
440447
"extra": f"Speedup: {speedup:.2f}x faster",
441-
"patch_file": patch_path,
448+
"patch_file": str(patch_path),
442449
"task_id": params.task_id,
443450
"explanation": best_optimization.explanation_v2,
444451
}

0 commit comments

Comments
 (0)