Show error and diagnostics when st.plotly_chart fails instead of silent pass
Previously the st.plotly_chart call was wrapped in 'except Exception: pass' which silently swallowed all rendering errors. The user would see no chart and no error message. Now: - Exception message is shown via st.error() - Diagnostics JSON is shown when debug is enabled (EXPLORER_DEBUG_TRAJECTORIES=1 or UI checkbox), even when trace_count > 0 This reveals the actual root cause when the chart fails to render.
This commit is contained in:
+11
-1
@@ -2096,8 +2096,18 @@ def choose_trajectory_title(axis_def: dict, axis: str, threshold: float = 0.65)
|
||||
else:
|
||||
try:
|
||||
st.plotly_chart(fig, use_container_width=True)
|
||||
except Exception as e:
|
||||
st.error(f"Trajectories rendering failed: {e}")
|
||||
# Always show diagnostics when rendering fails, regardless of trace_count
|
||||
if get_debug_trajectories_enabled():
|
||||
try:
|
||||
st.json(_last_trajectories_diagnostics)
|
||||
except Exception:
|
||||
pass
|
||||
st.text_area(
|
||||
"Trajectories diagnostics (JSON failed)",
|
||||
json.dumps(_last_trajectories_diagnostics, default=str),
|
||||
height=240,
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user