diff options
| author | Prasanna <[email protected]> | 2026-01-10 15:19:31 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-10 15:19:31 -0800 |
| commit | d015036b05133a0a836db51e1fd7157120947302 (patch) | |
| tree | da3cfdd2f1fe2d0a6e6bbd9be7bfd360f9889d1d /packages/pipecat-sdk-python/src/supermemory_pipecat/exceptions.py | |
| parent | docs: add S3 connector documentation (#657) (diff) | |
| download | supermemory-d015036b05133a0a836db51e1fd7157120947302.tar.xz supermemory-d015036b05133a0a836db51e1fd7157120947302.zip | |
pipecat-sdk (#663)
Diffstat (limited to 'packages/pipecat-sdk-python/src/supermemory_pipecat/exceptions.py')
| -rw-r--r-- | packages/pipecat-sdk-python/src/supermemory_pipecat/exceptions.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/packages/pipecat-sdk-python/src/supermemory_pipecat/exceptions.py b/packages/pipecat-sdk-python/src/supermemory_pipecat/exceptions.py new file mode 100644 index 00000000..1de8094f --- /dev/null +++ b/packages/pipecat-sdk-python/src/supermemory_pipecat/exceptions.py @@ -0,0 +1,58 @@ +"""Custom exceptions for Supermemory Pipecat integration.""" + +from typing import Optional + + +class SupermemoryPipecatError(Exception): + """Base exception for all Supermemory Pipecat errors.""" + + def __init__(self, message: str, original_error: Optional[Exception] = None): + super().__init__(message) + self.message = message + self.original_error = original_error + + def __str__(self) -> str: + if self.original_error: + return f"{self.message}: {self.original_error}" + return self.message + + +class ConfigurationError(SupermemoryPipecatError): + """Raised when there are configuration issues (e.g., missing API key, invalid params).""" + + +class MemoryRetrievalError(SupermemoryPipecatError): + """Raised when memory retrieval operations fail.""" + + +class MemoryStorageError(SupermemoryPipecatError): + """Raised when memory storage operations fail.""" + + +class APIError(SupermemoryPipecatError): + """Raised when Supermemory API requests fail.""" + + def __init__( + self, + message: str, + status_code: Optional[int] = None, + response_text: Optional[str] = None, + original_error: Optional[Exception] = None, + ): + super().__init__(message, original_error) + self.status_code = status_code + self.response_text = response_text + + def __str__(self) -> str: + parts = [self.message] + if self.status_code: + parts.append(f"Status: {self.status_code}") + if self.response_text: + parts.append(f"Response: {self.response_text}") + if self.original_error: + parts.append(f"Cause: {self.original_error}") + return " | ".join(parts) + + +class NetworkError(SupermemoryPipecatError): + """Raised when network operations fail.""" |