unstructured-ingest 1.2.10__py3-none-any.whl → 1.2.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of unstructured-ingest might be problematic. Click here for more details.

@@ -1 +1 @@
1
- __version__ = "1.2.10" # pragma: no cover
1
+ __version__ = "1.2.11" # pragma: no cover
@@ -0,0 +1,156 @@
1
+ from abc import ABC
2
+ from functools import wraps
3
+ from typing import Optional
4
+
5
+
6
+ class UnstructuredIngestError(Exception, ABC):
7
+ error_string: str
8
+ status_code: Optional[int] = None
9
+
10
+ @classmethod
11
+ def wrap(cls, f):
12
+ """
13
+ Provides a wrapper for a function that catches any exception and
14
+ re-raises it as the customer error. If the exception itself is already an instance
15
+ of the custom error, re-raises original error.
16
+ """
17
+
18
+ @wraps(f)
19
+ def wrapper(*args, **kwargs):
20
+ try:
21
+ return f(*args, **kwargs)
22
+ except BaseException as error:
23
+ if not isinstance(error, cls) and not issubclass(type(error), cls):
24
+ raise cls(cls.error_string.format(str(error))) from error
25
+ raise
26
+
27
+ return wrapper
28
+
29
+
30
+ class ConnectionError(UnstructuredIngestError):
31
+ error_string = "Connection error: {}"
32
+ status_code: Optional[int] = 400
33
+
34
+
35
+ class SourceConnectionError(ConnectionError):
36
+ error_string = "Error in getting data from upstream data source: {}"
37
+ status_code: Optional[int] = 400
38
+
39
+
40
+ class SourceConnectionNetworkError(SourceConnectionError):
41
+ error_string = "Error in connecting to upstream data source: {}"
42
+ status_code: Optional[int] = 400
43
+
44
+
45
+ class DestinationConnectionError(ConnectionError):
46
+ error_string = "Error in connecting to downstream data source: {}"
47
+ status_code: Optional[int] = 400
48
+
49
+
50
+ class EmbeddingEncoderConnectionError(ConnectionError):
51
+ error_string = "Error in connecting to the embedding model provider: {}"
52
+ status_code: Optional[int] = 400
53
+
54
+
55
+ class UserError(UnstructuredIngestError):
56
+ error_string = "User error: {}"
57
+ status_code: Optional[int] = 401
58
+
59
+
60
+ class UserAuthError(UserError):
61
+ error_string = "User authentication error: {}"
62
+ status_code: Optional[int] = 401
63
+
64
+
65
+ class RateLimitError(UserError):
66
+ error_string = "Rate limit error: {}"
67
+ status_code: Optional[int] = 429
68
+
69
+
70
+ class NotFoundError(UnstructuredIngestError):
71
+ error_string = "Not found error: {}"
72
+ status_code: Optional[int] = 404
73
+
74
+
75
+ class TimeoutError(UnstructuredIngestError):
76
+ error_string = "Timeout error: {}"
77
+ status_code: Optional[int] = 408
78
+
79
+
80
+ class ResponseError(UnstructuredIngestError):
81
+ error_string = "Response error: {}"
82
+ status_code: Optional[int] = 400
83
+
84
+
85
+ class WriteError(UnstructuredIngestError):
86
+ error_string = "Error in writing to downstream data source: {}"
87
+ status_code: Optional[int] = 400
88
+
89
+
90
+ class ProviderError(UnstructuredIngestError):
91
+ error_string = "Provider error: {}"
92
+ status_code: Optional[int] = 500
93
+
94
+
95
+ class ValueError(UnstructuredIngestError):
96
+ error_string = "Value error: {}"
97
+
98
+
99
+ class PartitionError(UnstructuredIngestError):
100
+ error_string = "Error in partitioning content: {}"
101
+
102
+
103
+ class QuotaError(UserError):
104
+ error_string = "Quota error: {}"
105
+
106
+
107
+ class MissingCategoryError(UnstructuredIngestError):
108
+ error_string = "Missing category error: {}"
109
+
110
+
111
+ class ValidationError(UnstructuredIngestError):
112
+ error_string = "Validation error: {}"
113
+
114
+
115
+ class KeyError(UnstructuredIngestError):
116
+ error_string = "Key error: {}"
117
+
118
+
119
+ class FileExistsError(UnstructuredIngestError):
120
+ error_string = "File exists error: {}"
121
+
122
+
123
+ class TypeError(UnstructuredIngestError):
124
+ error_string = "Type error: {}"
125
+
126
+
127
+ class IcebergCommitFailedException(UnstructuredIngestError):
128
+ error_string = "Failed to commit changes to the iceberg table"
129
+
130
+
131
+ recognized_errors = [
132
+ UserError,
133
+ UserAuthError,
134
+ RateLimitError,
135
+ QuotaError,
136
+ ProviderError,
137
+ NotFoundError,
138
+ TypeError,
139
+ ValueError,
140
+ FileExistsError,
141
+ TimeoutError,
142
+ KeyError,
143
+ ResponseError,
144
+ ValidationError,
145
+ PartitionError,
146
+ WriteError,
147
+ ConnectionError,
148
+ SourceConnectionError,
149
+ SourceConnectionNetworkError,
150
+ DestinationConnectionError,
151
+ EmbeddingEncoderConnectionError,
152
+ ]
153
+
154
+
155
+ def is_internal_error(e: Exception) -> bool:
156
+ return any(isinstance(e, recognized_error) for recognized_error in recognized_errors)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unstructured_ingest
3
- Version: 1.2.10
3
+ Version: 1.2.11
4
4
  Summary: Local ETL data pipeline to get data RAG ready
5
5
  Author-email: Unstructured Technologies <devops@unstructuredai.io>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,7 @@
1
1
  unstructured_ingest/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
2
- unstructured_ingest/__version__.py,sha256=cwCkGZK5VuW_6wke7mn3ASOcUbFt095tSTiZ2UhxxeQ,43
2
+ unstructured_ingest/__version__.py,sha256=ah-eP2N3WKTgQpNwUrBqGx6pOEXxVpXyJiiqBeWRLvI,43
3
3
  unstructured_ingest/error.py,sha256=chM7zQSTKjaKaQt_2_QkoZDUwY5XPNeACML7JqOWRLY,4036
4
+ unstructured_ingest/errors_v2.py,sha256=chM7zQSTKjaKaQt_2_QkoZDUwY5XPNeACML7JqOWRLY,4036
4
5
  unstructured_ingest/logger.py,sha256=7e_7UeK6hVOd5BQ6i9NzRUAPCS_DF839Y8TjUDywraY,1428
5
6
  unstructured_ingest/main.py,sha256=82G_7eG4PNhc_xIqj4Y_sFbDV9VI-nwSfsfJQMzovMk,169
6
7
  unstructured_ingest/otel.py,sha256=YalGjdPPuZKRoIfGU-O62-EXkTvn5BWVyu-ztRflax4,4671
@@ -234,8 +235,8 @@ unstructured_ingest/utils/pydantic_models.py,sha256=BT_j15e4rX40wQbt8LUXbqfPhA3r
234
235
  unstructured_ingest/utils/string_and_date_utils.py,sha256=oXOI6rxXq-8ncbk7EoJK0WCcTXWj75EzKl8pfQMID3U,2522
235
236
  unstructured_ingest/utils/table.py,sha256=WZechczgVFvlodUWFcsnCGvBNh1xRm6hr0VbJTPxKAc,3669
236
237
  unstructured_ingest/utils/tls.py,sha256=Ra8Mii1F4VqErRreg76PBI0eAqPBC009l0sSHa8FdnA,448
237
- unstructured_ingest-1.2.10.dist-info/METADATA,sha256=_ovAcg2K6RnLUgeVh8RX698y0C4NJy6SiYZoyhgUZe8,8827
238
- unstructured_ingest-1.2.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
239
- unstructured_ingest-1.2.10.dist-info/entry_points.txt,sha256=gUAAFnjFPnBgThJSEbw0N5ZjxtaKlT1s9e05_arQrNw,70
240
- unstructured_ingest-1.2.10.dist-info/licenses/LICENSE.md,sha256=SxkKP_62uIAKb9mb1eH7FH4Kn2aYT09fgjKpJt5PyTk,11360
241
- unstructured_ingest-1.2.10.dist-info/RECORD,,
238
+ unstructured_ingest-1.2.11.dist-info/METADATA,sha256=WXxL9qEe3d3pG9xwxbuDRArBBGkDH3k2y1fhtNzcHPQ,8827
239
+ unstructured_ingest-1.2.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
240
+ unstructured_ingest-1.2.11.dist-info/entry_points.txt,sha256=gUAAFnjFPnBgThJSEbw0N5ZjxtaKlT1s9e05_arQrNw,70
241
+ unstructured_ingest-1.2.11.dist-info/licenses/LICENSE.md,sha256=SxkKP_62uIAKb9mb1eH7FH4Kn2aYT09fgjKpJt5PyTk,11360
242
+ unstructured_ingest-1.2.11.dist-info/RECORD,,