|
17 | 17 | "only PEP 249 exception types cross the boundary". Wrapped in |
18 | 18 | ``OperationalError`` here. |
19 | 19 |
|
| 20 | +Local missing transfer files deliberately retain the built-in |
| 21 | +``FileNotFoundError`` contract. |
| 22 | +
|
20 | 23 | These primitives live in their own module so both ``client.py`` |
21 | 24 | (which orchestrates PyO3 calls) and ``result_set.py`` (which calls |
22 | 25 | ``fetch_next_batch`` on the same kernel handles) can share them |
@@ -133,7 +136,8 @@ def reraise_kernel_error( |
133 | 136 | if file_transfer: |
134 | 137 | cls = ( |
135 | 138 | ProgrammingError |
136 | | - if code == "PermissionDenied" and getattr(exc, "http_status", None) is None |
| 139 | + if code in ("PermissionDenied", "InvalidArgument") |
| 140 | + and getattr(exc, "http_status", None) is None |
137 | 141 | else OperationalError |
138 | 142 | ) |
139 | 143 |
|
@@ -185,9 +189,10 @@ def reraise_kernel_error( |
185 | 189 | def wrap_kernel_exception( |
186 | 190 | what: str, exc: BaseException |
187 | 191 | ) -> "Union[Error, FileNotFoundError]": |
188 | | - """Map any exception from a PyO3 call site to a PEP 249 exception. |
| 192 | + """Map a PyO3 exception to the connector's public error contract. |
189 | 193 |
|
190 | 194 | - ``KernelError`` → mapped class with structured attrs forwarded. |
| 195 | + A local missing transfer file maps to ``FileNotFoundError``. |
191 | 196 | - Already-PEP-249 ``Error`` (e.g. raised by an inner caller that |
192 | 197 | already mapped) → passed through unchanged. |
193 | 198 | - Anything else (``TypeError`` / ``ValueError`` / etc. from PyO3 |
|
0 commit comments