Skip to content

Commit 6a9f6df

Browse files
committed
only catch OperationalError
1 parent 8eead38 commit 6a9f6df

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/seclab_taskflows/mcp_servers/gh_file_viewer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import os
1010
from sqlalchemy.orm import DeclarativeBase, mapped_column, Mapped
1111
from sqlalchemy import create_engine
12+
import sqlalchemy.exc
1213
from sqlalchemy.orm import Session
1314
from typing import Optional
1415
from pathlib import Path
@@ -56,8 +57,8 @@ def __repr__(self):
5657

5758
try:
5859
Base.metadata.create_all(engine, tables=[SearchResults.__table__])
59-
except Exception as e:
60-
logging.exception(f"Database already exists") # only log here, as this error likely only happens in test
60+
except sqlalchemy.exc.OperationalError as e:
61+
logging.exception(f"Database/Tables already exist(s)") # only log here, as this error likely only happens in test
6162

6263

6364
async def call_api(url: str, params: dict) -> str:

0 commit comments

Comments
 (0)