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:
parent
48848a65a7
commit
4b5c23faf6
2 changed files with 4 additions and 3 deletions
5
main.py
5
main.py
|
|
@ -579,7 +579,10 @@ if __name__ == "__main__":
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error starting client: {e}", file=sys.stderr)
|
print(f"Error starting client: {e}", file=sys.stderr)
|
||||||
if isinstance(e, sqlite3.OperationalError) and "database is locked" in str(e):
|
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)
|
sys.exit(1)
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ def mock_client():
|
||||||
def test_imports():
|
def test_imports():
|
||||||
"""Test that all necessary imports are available"""
|
"""Test that all necessary imports are available"""
|
||||||
# This will fail if any import is missing
|
# This will fail if any import is missing
|
||||||
import main
|
|
||||||
from mcp.server.fastmcp import FastMCP
|
|
||||||
from telethon import TelegramClient
|
from telethon import TelegramClient
|
||||||
from telethon.sessions import StringSession
|
from telethon.sessions import StringSession
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue