refactor: improve error message formatting in main.py and clean up test imports

- Reformatted the error message for database lock detection in main.py for better readability.
- Removed unnecessary imports from test_basic.py to streamline the test file.
This commit is contained in:
anonim 2025-03-31 18:56:30 +03:00
parent 48848a65a7
commit 4b5c23faf6
2 changed files with 4 additions and 3 deletions

View file

@ -579,7 +579,10 @@ if __name__ == "__main__":
except Exception as e:
print(f"Error starting client: {e}", file=sys.stderr)
if isinstance(e, sqlite3.OperationalError) and "database is locked" in str(e):
print("Database lock detected. Please ensure no other instances are running.", file=sys.stderr)
print(
"Database lock detected. Please ensure no other instances are running.",
file=sys.stderr
)
sys.exit(1)
asyncio.run(main())

View file

@ -24,8 +24,6 @@ def mock_client():
def test_imports():
"""Test that all necessary imports are available"""
# This will fail if any import is missing
import main
from mcp.server.fastmcp import FastMCP
from telethon import TelegramClient
from telethon.sessions import StringSession