mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-27 02:02:18 +01:00
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
class ValidationError(Exception):
|
|
"""General exception for validation errors."""
|
|
|
|
def __init__(self, message: str):
|
|
self.message = message
|
|
super().__init__(self.message)
|
|
|
|
|
|
class ConnectorValidationError(ValidationError):
|
|
"""General exception for connector validation errors."""
|
|
|
|
def __init__(self, message: str):
|
|
self.message = message
|
|
super().__init__(self.message)
|
|
|
|
|
|
class UnexpectedError(ValidationError):
|
|
"""Raised when an unexpected error occurs during connector validation.
|
|
|
|
Unexpected errors don't necessarily mean the credential is invalid,
|
|
but rather that there was an error during the validation process
|
|
or we encountered a currently unhandled error case.
|
|
"""
|
|
|
|
def __init__(self, message: str = "Unexpected error during connector validation"):
|
|
super().__init__(message)
|
|
|
|
|
|
class CredentialInvalidError(ConnectorValidationError):
|
|
"""Raised when a connector's credential is invalid."""
|
|
|
|
def __init__(self, message: str = "Credential is invalid"):
|
|
super().__init__(message)
|
|
|
|
|
|
class CredentialExpiredError(ConnectorValidationError):
|
|
"""Raised when a connector's credential is expired."""
|
|
|
|
def __init__(self, message: str = "Credential has expired"):
|
|
super().__init__(message)
|
|
|
|
|
|
class InsufficientPermissionsError(ConnectorValidationError):
|
|
"""Raised when the credential does not have sufficient API permissions."""
|
|
|
|
def __init__(
|
|
self, message: str = "Insufficient permissions for the requested operation"
|
|
):
|
|
super().__init__(message)
|