DrishtiSharma commited on
Commit
3a5953a
·
verified ·
1 Parent(s): 95e42f1

Update graph.py

Browse files
Files changed (1) hide show
  1. graph.py +7 -7
graph.py CHANGED
@@ -174,23 +174,23 @@ class EssayWriter:
174
  # Generate and save the graph in /tmp/
175
  dot.render(output_path, format="png", cleanup=False)
176
 
177
- # Check if the file exists in /tmp/
178
  graph_path = "/tmp/graph.png"
179
  if os.path.exists(graph_path):
180
  with open(log_file, "w") as f:
181
  f.write("✅ Graphviz successfully generated /tmp/graph.png\n")
182
  print("✅ Graphviz successfully generated /tmp/graph.png")
183
  else:
184
- with open(log_file, "w") as f:
185
- f.write("❌ Graphviz failed to generate /tmp/graph.png\n")
186
- print("❌ Graphviz failed to generate /tmp/graph.png") # Debugging print
187
- raise FileNotFoundError("❌ Graphviz failed to generate the workflow graph.")
188
 
189
  except Exception as e:
190
- error_message = f"❌ Error generating workflow visualization: {e}\n"
 
191
  with open(log_file, "w") as f:
192
  f.write(error_message)
193
- print(error_message)
 
 
194
 
195
 
196
 
 
174
  # Generate and save the graph in /tmp/
175
  dot.render(output_path, format="png", cleanup=False)
176
 
177
+ # Check if file exists
178
  graph_path = "/tmp/graph.png"
179
  if os.path.exists(graph_path):
180
  with open(log_file, "w") as f:
181
  f.write("✅ Graphviz successfully generated /tmp/graph.png\n")
182
  print("✅ Graphviz successfully generated /tmp/graph.png")
183
  else:
184
+ raise FileNotFoundError("❌ Graphviz failed to generate /tmp/graph.png")
 
 
 
185
 
186
  except Exception as e:
187
+ # Capture full traceback
188
+ error_message = f"❌ Error generating workflow visualization:\n{traceback.format_exc()}\n"
189
  with open(log_file, "w") as f:
190
  f.write(error_message)
191
+ print(error_message)
192
+ return error_message
193
+
194
 
195
 
196