pinecone.exceptions
1from pinecone.core.openapi.shared.exceptions import ( 2 PineconeException, 3 PineconeApiAttributeError, 4 PineconeApiTypeError, 5 PineconeApiValueError, 6 PineconeApiKeyError, 7 PineconeApiException, 8 NotFoundException, 9 UnauthorizedException, 10 ForbiddenException, 11 ServiceException, 12) 13from .exceptions import PineconeConfigurationError, PineconeProtocolError, ListConversionException 14 15__all__ = [ 16 "PineconeConfigurationError", 17 "PineconeProtocolError", 18 "PineconeException", 19 "PineconeApiAttributeError", 20 "PineconeApiTypeError", 21 "PineconeApiValueError", 22 "PineconeApiKeyError", 23 "PineconeApiException", 24 "NotFoundException", 25 "UnauthorizedException", 26 "ForbiddenException", 27 "ServiceException", 28 "ListConversionException", 29]
9class PineconeConfigurationError(PineconeException): 10 """Raised when a configuration error occurs."""
Raised when a configuration error occurs.
Inherited Members
- builtins.Exception
- Exception
- builtins.BaseException
- with_traceback
- add_note
- args
5class PineconeProtocolError(PineconeException): 6 """Raised when something unexpected happens mid-request/response."""
Raised when something unexpected happens mid-request/response.
Inherited Members
- builtins.Exception
- Exception
- builtins.BaseException
- with_traceback
- add_note
- args
2class PineconeException(Exception): 3 """The base exception class for all exceptions in the Pinecone Python SDK"""
The base exception class for all exceptions in the Pinecone Python SDK
Inherited Members
- builtins.Exception
- Exception
- builtins.BaseException
- with_traceback
- add_note
- args
52class PineconeApiAttributeError(PineconeException, AttributeError): 53 def __init__(self, msg, path_to_item=None): 54 """ 55 Raised when an attribute reference or assignment fails. 56 57 Args: 58 msg (str): the exception message 59 60 Keyword Args: 61 path_to_item (None/list) the path to the exception in the 62 received_data dict 63 """ 64 self.path_to_item = path_to_item 65 full_msg = msg 66 if path_to_item: 67 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 68 super(PineconeApiAttributeError, self).__init__(full_msg)
The base exception class for all exceptions in the Pinecone Python SDK
53 def __init__(self, msg, path_to_item=None): 54 """ 55 Raised when an attribute reference or assignment fails. 56 57 Args: 58 msg (str): the exception message 59 60 Keyword Args: 61 path_to_item (None/list) the path to the exception in the 62 received_data dict 63 """ 64 self.path_to_item = path_to_item 65 full_msg = msg 66 if path_to_item: 67 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 68 super(PineconeApiAttributeError, self).__init__(full_msg)
Raised when an attribute reference or assignment fails.
Arguments:
- msg (str): the exception message
Keyword Args:
path_to_item (None/list) the path to the exception in the received_data dict
Inherited Members
- builtins.AttributeError
- name
- obj
- builtins.BaseException
- with_traceback
- add_note
- args
6class PineconeApiTypeError(PineconeException, TypeError): 7 def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): 8 """Raises an exception for TypeErrors 9 10 Args: 11 msg (str): the exception message 12 13 Keyword Args: 14 path_to_item (list): a list of keys an indices to get to the 15 current_item 16 None if unset 17 valid_classes (tuple): the primitive classes that current item 18 should be an instance of 19 None if unset 20 key_type (bool): False if our value is a value in a dict 21 True if it is a key in a dict 22 False if our item is an item in a list 23 None if unset 24 """ 25 self.path_to_item = path_to_item 26 self.valid_classes = valid_classes 27 self.key_type = key_type 28 full_msg = msg 29 if path_to_item: 30 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 31 super(PineconeApiTypeError, self).__init__(full_msg)
The base exception class for all exceptions in the Pinecone Python SDK
7 def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): 8 """Raises an exception for TypeErrors 9 10 Args: 11 msg (str): the exception message 12 13 Keyword Args: 14 path_to_item (list): a list of keys an indices to get to the 15 current_item 16 None if unset 17 valid_classes (tuple): the primitive classes that current item 18 should be an instance of 19 None if unset 20 key_type (bool): False if our value is a value in a dict 21 True if it is a key in a dict 22 False if our item is an item in a list 23 None if unset 24 """ 25 self.path_to_item = path_to_item 26 self.valid_classes = valid_classes 27 self.key_type = key_type 28 full_msg = msg 29 if path_to_item: 30 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 31 super(PineconeApiTypeError, self).__init__(full_msg)
Raises an exception for TypeErrors
Arguments:
- msg (str): the exception message
Keyword Args:
path_to_item (list): a list of keys an indices to get to the current_item None if unset valid_classes (tuple): the primitive classes that current item should be an instance of None if unset key_type (bool): False if our value is a value in a dict True if it is a key in a dict False if our item is an item in a list None if unset
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args
34class PineconeApiValueError(PineconeException, ValueError): 35 def __init__(self, msg, path_to_item=None): 36 """ 37 Args: 38 msg (str): the exception message 39 40 Keyword Args: 41 path_to_item (list) the path to the exception in the 42 received_data dict. None if unset 43 """ 44 45 self.path_to_item = path_to_item 46 full_msg = msg 47 if path_to_item: 48 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 49 super(PineconeApiValueError, self).__init__(full_msg)
The base exception class for all exceptions in the Pinecone Python SDK
35 def __init__(self, msg, path_to_item=None): 36 """ 37 Args: 38 msg (str): the exception message 39 40 Keyword Args: 41 path_to_item (list) the path to the exception in the 42 received_data dict. None if unset 43 """ 44 45 self.path_to_item = path_to_item 46 full_msg = msg 47 if path_to_item: 48 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 49 super(PineconeApiValueError, self).__init__(full_msg)
Arguments:
- msg (str): the exception message
Keyword Args:
path_to_item (list) the path to the exception in the received_data dict. None if unset
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args
71class PineconeApiKeyError(PineconeException, KeyError): 72 def __init__(self, msg, path_to_item=None): 73 """ 74 Args: 75 msg (str): the exception message 76 77 Keyword Args: 78 path_to_item (None/list) the path to the exception in the 79 received_data dict 80 """ 81 self.path_to_item = path_to_item 82 full_msg = msg 83 if path_to_item: 84 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 85 super(PineconeApiKeyError, self).__init__(full_msg)
The base exception class for all exceptions in the Pinecone Python SDK
72 def __init__(self, msg, path_to_item=None): 73 """ 74 Args: 75 msg (str): the exception message 76 77 Keyword Args: 78 path_to_item (None/list) the path to the exception in the 79 received_data dict 80 """ 81 self.path_to_item = path_to_item 82 full_msg = msg 83 if path_to_item: 84 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 85 super(PineconeApiKeyError, self).__init__(full_msg)
Arguments:
- msg (str): the exception message
Keyword Args:
path_to_item (None/list) the path to the exception in the received_data dict
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args
88class PineconeApiException(PineconeException): 89 90 def __init__(self, status=None, reason=None, http_resp=None): 91 if http_resp: 92 self.status = http_resp.status 93 self.reason = http_resp.reason 94 self.body = http_resp.data 95 self.headers = http_resp.getheaders() 96 else: 97 self.status = status 98 self.reason = reason 99 self.body = None 100 self.headers = None 101 102 def __str__(self): 103 """Custom error messages for exception""" 104 error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) 105 if self.headers: 106 error_message += "HTTP response headers: {0}\n".format(self.headers) 107 108 if self.body: 109 error_message += "HTTP response body: {0}\n".format(self.body) 110 111 return error_message
The base exception class for all exceptions in the Pinecone Python SDK
90 def __init__(self, status=None, reason=None, http_resp=None): 91 if http_resp: 92 self.status = http_resp.status 93 self.reason = http_resp.reason 94 self.body = http_resp.data 95 self.headers = http_resp.getheaders() 96 else: 97 self.status = status 98 self.reason = reason 99 self.body = None 100 self.headers = None
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args
114class NotFoundException(PineconeApiException): 115 116 def __init__(self, status=None, reason=None, http_resp=None): 117 super(NotFoundException, self).__init__(status, reason, http_resp)
The base exception class for all exceptions in the Pinecone Python SDK
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args
126class ForbiddenException(PineconeApiException): 127 128 def __init__(self, status=None, reason=None, http_resp=None): 129 super(ForbiddenException, self).__init__(status, reason, http_resp)
The base exception class for all exceptions in the Pinecone Python SDK
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args
132class ServiceException(PineconeApiException): 133 134 def __init__(self, status=None, reason=None, http_resp=None): 135 super(ServiceException, self).__init__(status, reason, http_resp)
The base exception class for all exceptions in the Pinecone Python SDK
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args
13class ListConversionException(PineconeException, TypeError): 14 def __init__(self, message): 15 super().__init__(message)
The base exception class for all exceptions in the Pinecone Python SDK
Inherited Members
- builtins.BaseException
- with_traceback
- add_note
- args