File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,21 @@ class RequestEntityTooLarge(Exception):
3737 Exception raised when the given image is too large.
3838 """
3939
40+ def __init__ (self , response : Response ) -> None :
41+ """
42+ Args:
43+ response: The response returned by Vuforia.
44+ """
45+ super ().__init__ (response .text )
46+ self ._response = response
47+
48+ @property
49+ def response (self ) -> Response :
50+ """
51+ The response returned by Vuforia which included this error.
52+ """
53+ return self ._response
54+
4055
4156class TargetProcessingTimeout (Exception ):
4257 """
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ def query(
152152 )
153153
154154 if response .status_code == HTTPStatus .REQUEST_ENTITY_TOO_LARGE :
155- raise RequestEntityTooLarge
155+ raise RequestEntityTooLarge ( response = response )
156156
157157 if "Integer out of range" in response .text :
158158 raise MaxNumResultsOutOfRange (response = response )
Original file line number Diff line number Diff line change @@ -58,9 +58,13 @@ def test_image_too_large(
5858 A ``RequestEntityTooLarge`` exception is raised if an image which is too
5959 large is given.
6060 """
61- with pytest .raises (RequestEntityTooLarge ):
61+ with pytest .raises (RequestEntityTooLarge ) as exc :
6262 cloud_reco_client .query (image = png_too_large )
6363
64+ assert (
65+ exc .value .response .status_code == HTTPStatus .REQUEST_ENTITY_TOO_LARGE
66+ )
67+
6468
6569def test_cloudrecoexception_inheritance () -> None :
6670 """
You can’t perform that action at this time.
0 commit comments