CultriX commited on
Commit
b169ff8
·
1 Parent(s): 397ed3d

Feat: Enhance RepoMix error logging in app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -53,11 +53,12 @@ def run_repomix(repo_url_or_id, progress=gr.Progress(track_tqdm=True)):
53
  "--compress"
54
  ]
55
 
56
- process = subprocess.run(cmd, capture_output=True, text=True, check=False)
57
  progress(0.8, desc="Repomix command executed.")
58
 
59
  if process.returncode != 0:
60
- return f"Error running Repomix: {process.stderr}", None
 
61
 
62
  if os.path.exists(output_file_path):
63
  with open(output_file_path, 'r', encoding='utf-8') as f:
@@ -65,7 +66,8 @@ def run_repomix(repo_url_or_id, progress=gr.Progress(track_tqdm=True)):
65
  progress(1, desc="Repomix output processed.")
66
  return content, output_file_path # Return content and path for potential download
67
  else:
68
- return "Error: Repomix did not generate an output file.", None
 
69
 
70
  except Exception as e:
71
  progress(1, desc="Error during Repomix processing.")
 
53
  "--compress"
54
  ]
55
 
56
+ process = subprocess.run(cmd, capture_output=True, text=True, check=False, encoding='utf-8') # Added encoding
57
  progress(0.8, desc="Repomix command executed.")
58
 
59
  if process.returncode != 0:
60
+ error_details = f"Return Code: {process.returncode}\nStderr: {process.stderr}\nStdout: {process.stdout}"
61
+ return f"Error running Repomix:\n{error_details}", None
62
 
63
  if os.path.exists(output_file_path):
64
  with open(output_file_path, 'r', encoding='utf-8') as f:
 
66
  progress(1, desc="Repomix output processed.")
67
  return content, output_file_path # Return content and path for potential download
68
  else:
69
+ error_details = f"Return Code: {process.returncode}\nStderr: {process.stderr}\nStdout: {process.stdout}"
70
+ return f"Error: Repomix did not generate an output file at '{output_file_path}'.\nRepomix Output:\n{error_details}", None
71
 
72
  except Exception as e:
73
  progress(1, desc="Error during Repomix processing.")