mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-14 05:40:16 +02:00
* add support for image search * quick fix up * k * k * k * k * nit * quick fix for connector tests
24 lines
618 B
Python
24 lines
618 B
Python
"""
|
|
Standardized error handling utilities.
|
|
"""
|
|
from onyx.configs.app_configs import CONTINUE_ON_CONNECTOR_FAILURE
|
|
from onyx.utils.logger import setup_logger
|
|
|
|
logger = setup_logger()
|
|
|
|
|
|
def handle_connector_error(e: Exception, context: str) -> None:
|
|
"""
|
|
Standard error handling for connectors.
|
|
|
|
Args:
|
|
e: The exception that was raised
|
|
context: A description of where the error occurred
|
|
|
|
Raises:
|
|
The original exception if CONTINUE_ON_CONNECTOR_FAILURE is False
|
|
"""
|
|
logger.error(f"Error in {context}: {e}", exc_info=e)
|
|
if not CONTINUE_ON_CONNECTOR_FAILURE:
|
|
raise
|