|
11 | 11 |
|
12 | 12 | from ._authorization import authorization_header, rfc_1123_date |
13 | 13 | from ._result_codes import raise_for_result_code |
14 | | -from .exceptions import MatchProcessing, MaxNumResultsOutOfRange |
| 14 | +from .exceptions import ( |
| 15 | + ConnectionErrorPossiblyImageTooLarge, |
| 16 | + MatchProcessing, |
| 17 | + MaxNumResultsOutOfRange, |
| 18 | +) |
15 | 19 | from .include_target_data import CloudRecoIncludeTargetData |
16 | 20 |
|
17 | 21 |
|
@@ -68,6 +72,8 @@ def query( |
68 | 72 | which was recently added, updated or deleted and Vuforia |
69 | 73 | returns an error in this case. |
70 | 74 | ~vws.exceptions.ProjectInactive: The project is inactive. |
| 75 | + ~vws.exceptions.ConnectionErrorPossiblyImageTooLarge: The given |
| 76 | + image is too large. |
71 | 77 |
|
72 | 78 | Returns: |
73 | 79 | An ordered list of target details of matching targets. |
@@ -101,12 +107,15 @@ def query( |
101 | 107 | 'Content-Type': content_type_header, |
102 | 108 | } |
103 | 109 |
|
104 | | - response = requests.request( |
105 | | - method=method, |
106 | | - url=urljoin(base=self._base_vwq_url, url=request_path), |
107 | | - headers=headers, |
108 | | - data=content, |
109 | | - ) |
| 110 | + try: |
| 111 | + response = requests.request( |
| 112 | + method=method, |
| 113 | + url=urljoin(base=self._base_vwq_url, url=request_path), |
| 114 | + headers=headers, |
| 115 | + data=content, |
| 116 | + ) |
| 117 | + except requests.exceptions.ConnectionError as exc: |
| 118 | + raise ConnectionErrorPossiblyImageTooLarge from exc |
110 | 119 |
|
111 | 120 | if 'Integer out of range' in response.text: |
112 | 121 | raise MaxNumResultsOutOfRange(response=response) |
|
0 commit comments