hvoss-techfak commited on
Commit
c0fb813
·
verified ·
1 Parent(s): 7faed42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -89,6 +89,17 @@ DISPLAY_COL_MAP = {
89
  " Color": "Color (Hex)",
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  def _check_quota(required_sec: int):
94
  """
@@ -834,8 +845,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
834
  try:
835
  self.returncode = run_autoforge_process(self.cmd, self.log_path)
836
  except Exception as e:
837
- import traceback
838
- exc_str = str(e).strip()
839
  self.exc = e
840
  capture_exception(e) # still goes to Sentry
841
 
 
89
  " Color": "Color (Hex)",
90
  }
91
 
92
+ def exc_text(exc: BaseException) -> str:
93
+ """
94
+ Return the human-readable message of *exc*.
95
+ Falls back to the class name if the message is empty.
96
+ """
97
+ txt = str(exc).strip()
98
+ if txt:
99
+ return txt
100
+ if exc.args:
101
+ return " ".join(str(a) for a in exc.args).strip()
102
+ return exc.__class__.__name__
103
 
104
  def _check_quota(required_sec: int):
105
  """
 
845
  try:
846
  self.returncode = run_autoforge_process(self.cmd, self.log_path)
847
  except Exception as e:
848
+ exc_str = exc_text(exc)
 
849
  self.exc = e
850
  capture_exception(e) # still goes to Sentry
851