Spaces:
Running
Running
| import traceback | |
| from config import IN_SPACES | |
| def safe_err(msg: str, exc: Exception | None = None) -> str: | |
| """Return error messages based on environment (Spaces vs local).""" | |
| if IN_SPACES: | |
| return f"⚠️ {msg}" + (f" ({type(exc).__name__}: {exc})" if exc else "") | |
| else: | |
| tb = traceback.format_exc() if exc else "" | |
| return f"❌ {msg}\n\n{tb}" | |