mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-02 08:58:11 +02:00
Fix mypy errors
This commit is contained in:
parent
7748f4df94
commit
4c7c1b468b
@ -181,7 +181,7 @@ def _run_indexing(
|
||||
)
|
||||
|
||||
try:
|
||||
all_connector_doc_ids = set()
|
||||
all_connector_doc_ids: set[str] = set()
|
||||
for doc_batch in doc_batch_generator:
|
||||
# Check if connector is disabled mid run and stop if so unless it's the secondary
|
||||
# index being built. We want to populate it even for paused connectors
|
||||
@ -238,8 +238,8 @@ def _run_indexing(
|
||||
d.id
|
||||
for d in get_documents_for_connector_credential_pair(
|
||||
db_session=db_session,
|
||||
connector_id=index_attempt.connector_id,
|
||||
credential_id=index_attempt.credential_id,
|
||||
connector_id=db_connector.id,
|
||||
credential_id=db_credential.id,
|
||||
)
|
||||
}
|
||||
doc_ids_to_remove = list(
|
||||
@ -252,8 +252,8 @@ def _run_indexing(
|
||||
# delete docs from cc-pair and receive the number of completely deleted docs in return
|
||||
_delete_connector_credential_pair_batch(
|
||||
document_ids=doc_ids_to_remove,
|
||||
connector_id=index_attempt.connector_id,
|
||||
credential_id=index_attempt.credential_id,
|
||||
connector_id=db_connector.id,
|
||||
credential_id=db_credential.id,
|
||||
document_index=document_index,
|
||||
)
|
||||
|
||||
|
@ -82,16 +82,24 @@ from danswer.utils.variable_functionality import fetch_versioned_implementation
|
||||
logger = setup_logger()
|
||||
|
||||
|
||||
def validation_exception_handler(
|
||||
request: Request, exc: RequestValidationError
|
||||
) -> JSONResponse:
|
||||
def validation_exception_handler(request: Request, exc: Exception) -> JSONResponse:
|
||||
if not isinstance(exc, RequestValidationError):
|
||||
logger.error(
|
||||
f"Unexpected exception type in validation_exception_handler - {type(exc)}"
|
||||
)
|
||||
raise exc
|
||||
|
||||
exc_str = f"{exc}".replace("\n", " ").replace(" ", " ")
|
||||
logger.exception(f"{request}: {exc_str}")
|
||||
content = {"status_code": 422, "message": exc_str, "data": None}
|
||||
return JSONResponse(content=content, status_code=422)
|
||||
|
||||
|
||||
def value_error_handler(_: Request, exc: ValueError) -> JSONResponse:
|
||||
def value_error_handler(_: Request, exc: Exception) -> JSONResponse:
|
||||
if not isinstance(exc, ValueError):
|
||||
logger.error(f"Unexpected exception type in value_error_handler - {type(exc)}")
|
||||
raise exc
|
||||
|
||||
try:
|
||||
raise (exc)
|
||||
except Exception:
|
||||
|
Loading…
x
Reference in New Issue
Block a user